Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Ignore Wildcard #212

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/pydocstyle/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,10 @@ def _get_exclusive_error_codes(options):
checked_codes = None

if options.ignore is not None:
checked_codes = codes - options.ignore
checked_codes = set()
for code in codes:
if not code.startswith(tuple(options.ignore)):
checked_codes.add(code)
elif options.select is not None:
checked_codes = options.select
elif options.convention is not None:
Expand Down
14 changes: 14 additions & 0 deletions src/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,20 @@ def foo():
assert 'D103' not in err


def test_ignore_cli_wildcard(env):
"""Test ignoring error codes with `--ignore` wildcard in the CLI."""
with env.open('example.py', 'wt') as example:
example.write(textwrap.dedent("""\
def foo():
pass
"""))

out, err, code = env.invoke(args="--ignore=D10")
assert code == 0
assert 'D100' not in out
assert 'D103' not in out


def test_select_config(env):
"""Test choosing error codes with `select` in the config file."""
with env.open('example.py', 'wt') as example:
Expand Down