Pre-commit: Add `--exclude` option to CLI for skipping specific hooks

Created on 29 May 2019  路  3Comments  路  Source: pre-commit/pre-commit

I'd like to see some way to prevent running specific tests when using pre-commit run. My use case is that I want to use the no-commit-to-branch hook locally for commits (e.g. to block direct commits to "master"), but I don't want this particular test to run on my CI system (since the no-commit-to-branch test fails if running CI checks after merging a PR into these branches). I know I can run each pre-commit hook individually in my CI system (as I'm currently doing) or use an alternate configuration file, but the --exclude option seems like a cleaner approach.

Perhaps something like this can be used: pre-commit run --all-files --exclude="no-commit-to-branch,flake8"

question

Most helpful comment

You're looking for either SKIP= Or stages: [manual] depending on which direction you want

All 3 comments

You're looking for either SKIP= Or stages: [manual] depending on which direction you want

Thanks @asottile, just what I needed :)

Awesome! Thanks for the issue 馃帀 -- sorry if I was brief, I tapped that out on my phone :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eyalzek picture eyalzek  路  3Comments

Cielquan picture Cielquan  路  3Comments

AdrienLemaire picture AdrienLemaire  路  4Comments

kringol picture kringol  路  4Comments

fczuardi picture fczuardi  路  3Comments