-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Husky pre-push hooks to run linters #1215
Comments
@JYLee-GIT @fzdy1914 what do you think about this suggestion? |
Let's abandon this. I think that it is better if such errors appear on GitHub itself instead of locally as a Git hook, so that it is easier for senior developers to guide newcomers if necessary. In other cases, code style issues are minor and does not affect the review workflow. Having this hook requires writing a custom script which adds additional maintenance burden. |
Pretty sure that when code style issues are detected the CI tests would just fail, and senior developers usually do not look at PR with failed tests. I think a hook which checks for code style would be nice since if I forgot to run the linter before I push, I get reminded of my mistakes immediately instead of 5min later when the CI fails. |
We don't use this technique in our other projects. Which means we can survive without it. But I don't mind giving it a try just to see how it goes. There might be some value if not a lot. Let's keep it, but with a low priority. |
I think one possible reason why this issue is relevant is because of the different abstraction level for RepoSense/.github/workflows/integration.yml Lines 155 to 156 in 25f4ce2
Most other linters are run in Gradle ( |
Considering the adoption of git hooks in other NUS-OSS projects like MarkBind and CATcher, it's worth exploring implementing pre-commit and pre-push hooks in RepoSense for linting. Notably, Markbind uses the pre-commit package and CATcher uses Husky for this. Considering that Husky (1) is actively maintained, (2) is the more popular tool, and (3) has easier configuration scripts, let us introduce Husky pre-push hooks to lint (and auto-fix) code in RepoSense. Furthermore, if we only want to run the linters on staged files, we can make use of lint-staged. Source: npm trends for git hook packages |
git push
is executed
There are often cases when we:
This process can be avoided if we automatically run the linters before
git push
is executed.We can use a git hook for this
The text was updated successfully, but these errors were encountered: