Useful git pre-commit hook for linting Java code.
It uses as default The Google Style Guide and the famous Checkstyle linter as a plugin for pre-commit.
Don't you know who is Leeroy Jenkins?
First install the gems.
gem install pre-commit
gem install java-checkstyle
Take a look here Install with RVM
Use the pre-commit command to generate a stub pre-commit hook. Inside folder of your git repo:
pre-commit install
It will create a .git/hooks/pre-commit script which will check your git config and run checks that are enabled.
pre-commit enable git checks checkstyle
Every time you try to commit some java code with style errors it will validate for you ensuring that your code will be always awesome.
Still don't work? Try the detailed version here
It uses as default The Google Style Guide.
Running tests with rspec
Make sure you have been executed:
bundle install
Then run:
rspec
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Before push, make sure you have been executed rubocop
bundle exec rake ci
Pull request should have Unit Tests
- Allen Madsen (Original Version 0.0.1)
- Alex Rocha
- Cristian Oliveira