Overcommit configuration for rails/es6 projects · GitHub
source link: https://gist.github.com/llekn/b64231949f1e3e0463b90d6a5b828e08
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Overcommit
Overview
Overcommit is a gem that makes easy to add, configure and run tasks on git hooks (script that are run when manipulating a git repo, for example, before making a commit).
Setup
- Add the gem
overcommit
to development environment, or install it globally on you machine withgem install overcommit
- On the project on which you want to use
overcommit
, install the git hooks provided byovercommit
:overcommit --install
- Configure
overcommit
to run the tasks that you want by editing the.overcommit.yml
faile. - As a security measure, each time that you make changes to the
.overcommit.yml
file or to the git hook you need to "sign" the configuration again (to prevent running malicious scripts that could be added in a remote commit). So, as last step you have to runovercommit --sign
Configuration
A minimal .overcommit.yml
config file that only runs rubocop before a commit looks like:
PreCommit:
RuboCop:
enabled: true
on_warn: fail
A very nice overcommit
configuration that runs rubocop
and eslint
can be found at: https://gist.github.com/llekn/b64231949f1e3e0463b90d6a5b828e08#file-overcommit-yml
For a complete list of available hooks you can check https://github.com/brigade/overcommit#built-in-hooks
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK