mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Implement check-files-matches-any meta hook
This commit is contained in:
parent
8df11ee7aa
commit
8a0dd01c7e
3 changed files with 76 additions and 0 deletions
|
|
@ -735,6 +735,39 @@ def test_useless_exclude_for_hook(
|
|||
)
|
||||
|
||||
|
||||
def test_files_match_any(
|
||||
cap_out, repo_with_passing_hook, mock_out_store_directory,
|
||||
):
|
||||
config = OrderedDict((
|
||||
('repo', 'meta'),
|
||||
(
|
||||
'hooks', (
|
||||
OrderedDict((
|
||||
('id', 'check-files-matches-any'),
|
||||
)),
|
||||
OrderedDict((
|
||||
('id', 'check-useless-excludes'),
|
||||
('files', 'foo'),
|
||||
)),
|
||||
),
|
||||
),
|
||||
))
|
||||
add_config_to_repo(repo_with_passing_hook, config)
|
||||
|
||||
_test_run(
|
||||
cap_out,
|
||||
repo_with_passing_hook,
|
||||
opts={'all_files': True},
|
||||
expected_outputs=[
|
||||
b'Check hooks match any files',
|
||||
b'The files pattern for check-useless-excludes '
|
||||
b'does not match any files',
|
||||
],
|
||||
expected_ret=1,
|
||||
stage=False,
|
||||
)
|
||||
|
||||
|
||||
@pytest.yield_fixture
|
||||
def modified_config_repo(repo_with_passing_hook):
|
||||
with modify_config(repo_with_passing_hook, commit=False) as config:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue