Skip to content
Merged
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
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/10669.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Make 'ignore' option work as expected again.

Closes #10669
2 changes: 1 addition & 1 deletion pylint/lint/expand_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def expand_modules(
)
if has_init or is_namespace or is_directory:
for subfilepath in modutils.get_module_files(
os.path.dirname(filepath) or ".", [], list_all=is_namespace
os.path.dirname(filepath) or ".", ignore_list, list_all=is_namespace
):
subfilepath = os.path.normpath(subfilepath)
if filepath == subfilepath:
Expand Down
20 changes: 20 additions & 0 deletions tests/lint/unittest_expand_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,3 +326,23 @@ def test_expand_modules_with_ignore(
)
assert {k: v for k, v in modules.items() if not v["isignored"]} == expected
assert not errors

@set_config(ignore=["test"])
def test_expand_modules_with_ignore_list(self) -> None:
"""Test expand_modules with a non-default value of ignore."""
ignore_list: list[str] = self.linter.config.ignore
ignore_list_re = [re.compile("^\\.#")]
path = Path(__file__).parent.parent / "regrtest_data" / "ignore_option_10669"
modules, errors = expand_modules(
[str(path)],
[],
ignore_list,
ignore_list_re,
[],
)
expected_keys = {
str(path / "__init__.py"),
str(path / "main.py"),
}
assert {k for k, v in modules.items() if not v["isignored"]} == expected_keys
assert not errors
Empty file.
3 changes: 3 additions & 0 deletions tests/regrtest_data/ignore_option_10669/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# pylint: disable=too-few-public-methods,missing-docstring
class A:
pass
4 changes: 4 additions & 0 deletions tests/regrtest_data/ignore_option_10669/test/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

class i:
"""many issues here"""
pass
Loading