[yast-devel] Overcommit - automatic checks via Git hooks
Hi, I found a quite interesting tool called Overcommit [1]. It provides an easy way for setting up Git commit hooks and provides some basic checking plugins. The nice feature of the Git commit hooks is that you can run some checks automatically and early in the development. For example with the commit hooks you can run Rubocop check automatically whenever a commit is created. And if the check fails the commit is not created. I can see "make Rubocop happy" commits quite often (happens to me as well), with Overcommit you can easily avoid that. I have tried several Overcommit checks: - Rubocop - runs Rubocop at "commit" - Rspec - runs the tests before "push" - Branch blacklist - can forbid direct commits to configured branches, e.g. "master" (forces using pull requests, avoids commits to master my mistake) - Commit message spellcheck - warns when there is a possible typo Check my blog post [2] for the details, esp. watch the recorded screencast where I wanted to show some mistakes which it can catch. The tool looks promising, I'll try using it for some time. If you want to try it as well check the blog post for the installation steps. Enjoy! [1] https://github.com/brigade/overcommit [2] http://blog.ladslezak.cz/2016/06/06/overcommit/ -- Ladislav Slezák Appliance department / YaST Developer Lihovarská 1060/12 190 00 Prague 9 / Czech Republic tel: +420 284 028 960 lslezak@suse.com SUSE -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
run Rubocop check automatically whenever a commit is created. And if the check fails the commit is not created.
I can see "make Rubocop happy" commits quite often (happens to me as well), with Overcommit you can easily avoid that.
in particular for rubocop checks I've started to use 'syntastic' vim plugin (https://github.com/scrooloose/syntastic/) with rubocop as a checker Michal Filka -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
Dne 7.6.2016 v 10:26 Ladislav Slezak napsal(a):
Hi,
I found a quite interesting tool called Overcommit [1].
[...]
The tool looks promising, I'll try using it for some time. If you want to try it as well check the blog post for the installation steps.--
To make the usage in YaST easier I have created a simple script [1] which recursively scans a directory and installs the overcommit hooks in each Git repository found. So you can easily install the hooks in all YaST repositories using e.g. wget https://raw.githubusercontent.com/lslezak/scripts/master/git/install_overcom... ruby install_overcommit.rb ~/git/yast (adapt the path to your YaST Git checkout) The script detects some repository properties automatically, e.g. if ".rubocop.yml" is found then the Rubocop check is enabled otherwise it is disabled. Enjoy! -- Best Regards Ladislav Slezák Yast Developer ------------------------------------------------------------------------ SUSE LINUX, s.r.o. e-mail: lslezak@suse.cz Lihovarská 1060/12 tel: +420 284 028 960 190 00 Prague 9 fax: +420 284 028 951 Czech Republic http://www.suse.cz/ -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
Dne 10. 06. 16 v 20:06 Ladislav Slezak napsal(a):
Dne 7.6.2016 v 10:26 Ladislav Slezak napsal(a):
Hi,
I found a quite interesting tool called Overcommit [1].
[...]
The tool looks promising, I'll try using it for some time. If you want to try it as well check the blog post for the installation steps.--
To make the usage in YaST easier I have created a simple script [1] which recursively scans a directory and installs the overcommit hooks in each Git repository found.
So you can easily install the hooks in all YaST repositories using e.g.
wget https://raw.githubusercontent.com/lslezak/scripts/master/git/install_overcom... ruby install_overcommit.rb ~/git/yast
I have improved the script and moved it to the YaST "helper_scripts" repository. See more details in the REAMDE. https://github.com/yast/helper_scripts/tree/master/git/overcommit http://www.suse.cz/ -- Ladislav Slezák YaST Developer SUSE LINUX, s.r.o. Corso IIa Křižíkova 148/34 18600 Praha 8
participants (3)
-
Ladislav Slezak
-
Ladislav Slezák
-
Michal Filka