Merge pull request #654 from pre-commit/always_run_always_applies

always_run hooks always apply to the repository
This commit is contained in:
Anthony Sottile 2017-11-03 12:14:33 -05:00 committed by GitHub
commit 0ec3b5556f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -14,6 +14,8 @@ def check_all_hooks_match_files(config_file):
for repo in runner.repositories:
for hook_id, hook in repo.hooks:
if hook['always_run']:
continue
include, exclude = hook['files'], hook['exclude']
filtered = _filter_by_include_exclude(files, include, exclude)
types, exclude_types = hook['types'], hook['exclude_types']

View file

@ -116,6 +116,12 @@ def test_valid_includes(
OrderedDict((
('id', 'check-useless-excludes'),
)),
# Should not be reported as an error due to always_run
OrderedDict((
('id', 'check-useless-excludes'),
('files', '^$'),
('always_run', True),
)),
),
),
))