-
Notifications
You must be signed in to change notification settings - Fork 119
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
ci: Added pre-commit-hook #1320
Conversation
Timestamp: 2020-11-17 16:12:54 |
Codecov Report
@@ Coverage Diff @@
## master #1320 +/- ##
============================================
- Coverage 79.64% 79.61% -0.03%
+ Complexity 736 735 -1
============================================
Files 237 237
Lines 4573 4573
Branches 792 792
============================================
- Hits 3642 3641 -1
- Misses 525 526 +1
Partials 406 406 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linkHooks.sh
was not executable so I have changed it using chmod +x
.
After that, I have added empty lines to a random kotlin file and tested pre-commit
MacBook-Pro-jan-gogo:flank-review jan-gogo$ git commit -m 'Test pre-commit'
hint: The '.githooks//pre-commit' hook was ignored because it's not set as executable.
hint: You can disable this warning with `git config advice.ignoredHook false`.
[#1305-git-hooks 19bd8833] Test pre-commit
1 file changed, 9 insertions(+)
So I have changed pre-commit
to executable and tried test again.
This is what I get:
MacBook-Pro-jan-gogo:flank-review jan-gogo$ git commit -m 'Test pre-commit'
fatal: cannot run .githooks//pre-commit: No such file or directory
Strange
Please retest it was a faulty shebang line. |
a349d78
to
6360fc3
Compare
Maybe we could add information about run |
I fixed it |
fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if pre-commit
script will work on windows so linkHooks.bat
probably is not necessary, but also I am not sure if any dev will use windows as the main os for development, so it's not a problem.
I use windows and it works correctly 👍 |
Fixes #1305
Needs to be tested locally to actually see a change.
It requires a once off execution of the link Hook sh file.
Simply try git commit and it should run detekt.