README.md in pre-commit-0.12.0 vs README.md in pre-commit-0.13.0

- old
+ new

@@ -18,11 +18,11 @@ # In your git repo $ pre-commit install This creates a .git/hooks/pre-commit script which will check your git config and run checks that are enabled. -## Configuration +## Available checks These are the available checks: * white_space * console_log @@ -41,31 +41,54 @@ * ci (Will run the `pre_commit:ci` rake task and pass or fail accordingly) * rubocop (Check ruby code style using the rubocop gem. Rubocop must be installed) * before_all (Check your RSpec tests for the use of `before(:all)`) * coffeelint (Check your coffeescript files using the [coffeelint gem.](https://github.com/clutchski/coffeelint)) -To configure which checks you would like to run, simply set the `pre-commit.checks` git configuration setting. +## Default checks -To enable `white_space` and `tab` checks: +Use `pre-commit list` to see the list of default and enabled checks and warnings. - # From your git repo - $ git config "pre-commit.checks" "white_space, tabs" +## Enabling / Disabling Checks / Warnings -To enable `white_space`, `console_log` and `debugger` checks: +### 0.12.0 and lower - # From your git repo - $ git config "pre-commit.checks" "white_space, console_log, debugger" + git config pre-commit.checks "whitespace, jshint, debugger" -Note: If no checks are configured, a default set of checks is run: +To disable, simply leave one off the list - white_space, console_log, debugger, pry, tabs, jshint, migrations, merge_conflict, local + git config pre-commit.checks "whitespace, jshint" -You may also enable checks that will produce warnings if detected but NOT stop the commit: +### 0.13.0 and higher - # From your git repo - $ git config "pre-commit.warnings" "jshint, ruby_symbol_hashrockets" +```ssh +pre-commit <enable|disbale> <git|yaml> <checks|warnings> check1 [check2...] +``` +The `git` provider can be used for local machine configuration, the `yaml` can be used for shared +project configuration. -For the rubocop check, you can tell it what config file to use by setting a path relative to the repo: +Example move `jshint` from `checks` to `warnings` in `yaml` provider and save configuration to git: +```bash +pre-commit disbale yaml checks jshint +pre-commit enable yaml warnings jshint +git add config/pre-commit.yml +git commit -m "pre-commit: move jshint from checks to warnings" +``` - # From your git repo - $ git config "pre-commit.rubocop.config" "config/rubocop.yml" +Example `config/pre_commit.yml`: +```yaml +--- +:warnings_remove: [] +:warnings_add: +- :jshint +- :tabs +``` + +## Configuration providers + +`pre-commit` comes with 3 configuration providers: + +- `default` - basic settings, read only +- `git` - reads configuration from `git config pre-commit.*`, allow local update +- `yaml` - reads configuration from `/etc/pre-commit.yml`, `$HOME/.pre-commit.yml` and `config/pre-commit.yml`, allows `config/pre-commit.yml` updates + +## [Contributing](CONTRIBUTING.md)