Add pre-commit hooks to run code checks
See original GitHub issue⚠️ Is your feature request related to a problem? Please describe
It seems that contributors often have to do multiple commits, since their contributions have issues with styling etc.
💡 Describe the solution you’d like
It might be more convenient to run ktlintCheck
and detekt
tasks as a pre-commit hook. With these changes contributors could be sure that their code passes Chucker checks and also make our library build process a little more eco-friendly, since we won’t have to spin up Travis CI that often 🌲
📄 Additional context
We might also include test
step as well.
🙋 Do you want to develop this feature yourself?
- Yes
- No
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Supported hooks - pre-commit
cheetah-reorder-imports - This hook reorders imports in cheetah files. cheetah-flake - Lint cheetah code using flake8 and some other checks. github.com/ ...
Read more >Using pre-commit git hooks to automate code checks - Eric J. Ma
Git hooks are an awesome way to automate checks on your codebase locally before committing them to your code repository. That said, setting...
Read more >Using Precommit Hooks For Static Code Analysis
In this article we'll discuss how to use Git's pre-commit hooks to run our static code analysis tools on just the set of...
Read more >Trusting a Git pre-commit hook to Run Checks Automatically
3. Now, create a Git hook Shell script named pre-commit.sh by copying and pasting the code below to your script and save it...
Read more >Automating Code Checks and Tests with Git Hooks - AntStack
The most common way to add checks to your codebase is to use husky and lint-staged. I have used husky many times to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am currently playing around with pre-commit hook, which is installed from
clean
task as suggested, which runs bothdetekt
andktlintCheck
commands. Let’s install it automatically, since I don’t hope that people will actually read these recommendations.ktlint-gradle might be able to help
https://github.com/jlleitschuh/ktlint-gradle
I think they recommended (overheard in kotlinglang slack) adding that to the clean task in your gradle project so that it gets added to everyones machine.