mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-19 17:14:43 +04:00
Fix check-useless-exclude to consider types filter
This commit is contained in:
parent
08319101f4
commit
1b496c5fc3
2 changed files with 35 additions and 1 deletions
|
|
@ -51,6 +51,37 @@ def test_useless_exclude_for_hook(capsys, tempdir_factory):
|
|||
assert expected == out
|
||||
|
||||
|
||||
def test_useless_exclude_with_types_filter(capsys, tempdir_factory):
|
||||
config = {
|
||||
'repos': [
|
||||
{
|
||||
'repo': 'meta',
|
||||
'hooks': [
|
||||
{
|
||||
'id': 'check-useless-excludes',
|
||||
'exclude': '.pre-commit-config.yaml',
|
||||
'types': ['python'],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
repo = git_dir(tempdir_factory)
|
||||
add_config_to_repo(repo, config)
|
||||
|
||||
with cwd(repo):
|
||||
assert check_useless_excludes.main(()) == 1
|
||||
|
||||
out, _ = capsys.readouterr()
|
||||
out = out.strip()
|
||||
expected = (
|
||||
"The exclude pattern '.pre-commit-config.yaml' for "
|
||||
"check-useless-excludes does not match any files"
|
||||
)
|
||||
assert expected == out
|
||||
|
||||
|
||||
def test_no_excludes(capsys, tempdir_factory):
|
||||
config = {
|
||||
'repos': [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue