Not even once!
Run relevant code-checking tools on your code, before it is even checked in locally. Using the Ruby project Overcommit, you can set this up on your own machine in a jiffy. Or, read more about git hooks.
I took these steps:
- Install the
overcommit
gem in your active Ruby.gem i overcommit
- Install overcommit in your system Ruby, using this neat trick:
PATH=/usr/bin:/bin:/usr/sbin:/sbin sudo gem install overcommit
– This makes it available to tools like SourceTree! (On committing, it opens a bare shell, without your cool settings.) - In your project directory, where you wish to begin using Overcommit to run Git hooks:
overcommit --init
- Configure the resulting
.overcommit.yml
to enable/disable the checks you want run. - Try committing a file which would fail a check.
- Profit!
PS: Here is an example .overcommit.yml
:
PreCommit: ALL: problem_on_unmodified_line: warn CoffeeLint: enabled: true RuboCop: enabled: true