mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Merge pull request #654 from pre-commit/always_run_always_applies
always_run hooks always apply to the repository
This commit is contained in:
commit
0ec3b5556f
2 changed files with 8 additions and 0 deletions
|
|
@ -14,6 +14,8 @@ def check_all_hooks_match_files(config_file):
|
||||||
|
|
||||||
for repo in runner.repositories:
|
for repo in runner.repositories:
|
||||||
for hook_id, hook in repo.hooks:
|
for hook_id, hook in repo.hooks:
|
||||||
|
if hook['always_run']:
|
||||||
|
continue
|
||||||
include, exclude = hook['files'], hook['exclude']
|
include, exclude = hook['files'], hook['exclude']
|
||||||
filtered = _filter_by_include_exclude(files, include, exclude)
|
filtered = _filter_by_include_exclude(files, include, exclude)
|
||||||
types, exclude_types = hook['types'], hook['exclude_types']
|
types, exclude_types = hook['types'], hook['exclude_types']
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,12 @@ def test_valid_includes(
|
||||||
OrderedDict((
|
OrderedDict((
|
||||||
('id', 'check-useless-excludes'),
|
('id', 'check-useless-excludes'),
|
||||||
)),
|
)),
|
||||||
|
# Should not be reported as an error due to always_run
|
||||||
|
OrderedDict((
|
||||||
|
('id', 'check-useless-excludes'),
|
||||||
|
('files', '^$'),
|
||||||
|
('always_run', True),
|
||||||
|
)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
))
|
))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue