From bcfdd9b57723c4fd03773a30c1b9dfab7e1c4266 Mon Sep 17 00:00:00 2001 From: sonnyv Date: Tue, 4 Nov 2025 10:32:00 +0100 Subject: [PATCH 1/6] fix(expand_modules): pass ignore_list to modutils.get_module_files --- pylint/lint/expand_modules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylint/lint/expand_modules.py b/pylint/lint/expand_modules.py index 0116c9bb7a..d51af24f60 100644 --- a/pylint/lint/expand_modules.py +++ b/pylint/lint/expand_modules.py @@ -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: From e4b7473530817e90ae38ce2672dc6f5f587f8336 Mon Sep 17 00:00:00 2001 From: sonnyv Date: Tue, 4 Nov 2025 11:41:06 +0100 Subject: [PATCH 2/6] docs: add news fragment --- doc/whatsnew/fragments/10669.bugfix | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 doc/whatsnew/fragments/10669.bugfix diff --git a/doc/whatsnew/fragments/10669.bugfix b/doc/whatsnew/fragments/10669.bugfix new file mode 100644 index 0000000000..035d3389d8 --- /dev/null +++ b/doc/whatsnew/fragments/10669.bugfix @@ -0,0 +1,3 @@ +Make 'ignore' option work as expected again. + +Closes #10669 From cf5a9e651e1cbba59f143f7e527f1901db4c1acb Mon Sep 17 00:00:00 2001 From: Sonny V Date: Wed, 12 Nov 2025 22:20:36 +0100 Subject: [PATCH 3/6] tests: add regression test for expand_modules --- tests/lint/unittest_expand_modules.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/lint/unittest_expand_modules.py b/tests/lint/unittest_expand_modules.py index 054687d0ab..e7eeb2eba4 100644 --- a/tests/lint/unittest_expand_modules.py +++ b/tests/lint/unittest_expand_modules.py @@ -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 From 940238fd70da9e4cc202ca7ef000ea6d626a8996 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 12 Nov 2025 21:21:57 +0000 Subject: [PATCH 4/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/lint/unittest_expand_modules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lint/unittest_expand_modules.py b/tests/lint/unittest_expand_modules.py index e7eeb2eba4..164c99968a 100644 --- a/tests/lint/unittest_expand_modules.py +++ b/tests/lint/unittest_expand_modules.py @@ -331,7 +331,7 @@ def test_expand_modules_with_ignore( 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('^\\.#'),) + ignore_list_re = (re.compile("^\\.#"),) path = Path(__file__).parent.parent / "regrtest_data" / "ignore_option_10669" modules, errors = expand_modules( [str(path)], From a6d050d2ba6019796944c44ceac53f6965bcd89b Mon Sep 17 00:00:00 2001 From: Sonny V Date: Wed, 12 Nov 2025 22:28:38 +0100 Subject: [PATCH 5/6] tests: include regrtest_data --- tests/lint/unittest_expand_modules.py | 2 +- tests/regrtest_data/ignore_option_10669/__init__.py | 0 tests/regrtest_data/ignore_option_10669/main.py | 3 +++ tests/regrtest_data/ignore_option_10669/test/__init__.py | 4 ++++ 4 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tests/regrtest_data/ignore_option_10669/__init__.py create mode 100644 tests/regrtest_data/ignore_option_10669/main.py create mode 100644 tests/regrtest_data/ignore_option_10669/test/__init__.py diff --git a/tests/lint/unittest_expand_modules.py b/tests/lint/unittest_expand_modules.py index 164c99968a..5b3a7ddbbe 100644 --- a/tests/lint/unittest_expand_modules.py +++ b/tests/lint/unittest_expand_modules.py @@ -331,7 +331,7 @@ def test_expand_modules_with_ignore( 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("^\\.#"),) + ignore_list_re = [re.compile("^\\.#")] path = Path(__file__).parent.parent / "regrtest_data" / "ignore_option_10669" modules, errors = expand_modules( [str(path)], diff --git a/tests/regrtest_data/ignore_option_10669/__init__.py b/tests/regrtest_data/ignore_option_10669/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/regrtest_data/ignore_option_10669/main.py b/tests/regrtest_data/ignore_option_10669/main.py new file mode 100644 index 0000000000..e3e9809903 --- /dev/null +++ b/tests/regrtest_data/ignore_option_10669/main.py @@ -0,0 +1,3 @@ +# pylint: disable=too-few-public-methods,missing-docstring +class A: + pass \ No newline at end of file diff --git a/tests/regrtest_data/ignore_option_10669/test/__init__.py b/tests/regrtest_data/ignore_option_10669/test/__init__.py new file mode 100644 index 0000000000..adc2b55bb9 --- /dev/null +++ b/tests/regrtest_data/ignore_option_10669/test/__init__.py @@ -0,0 +1,4 @@ + +class i: + """many issues here""" + pass \ No newline at end of file From f75ffd01bdf1cb26cfd8affdf1cc5aa93d6db77e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 12 Nov 2025 21:29:32 +0000 Subject: [PATCH 6/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/regrtest_data/ignore_option_10669/main.py | 2 +- tests/regrtest_data/ignore_option_10669/test/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/regrtest_data/ignore_option_10669/main.py b/tests/regrtest_data/ignore_option_10669/main.py index e3e9809903..a83ef2e8af 100644 --- a/tests/regrtest_data/ignore_option_10669/main.py +++ b/tests/regrtest_data/ignore_option_10669/main.py @@ -1,3 +1,3 @@ # pylint: disable=too-few-public-methods,missing-docstring class A: - pass \ No newline at end of file + pass diff --git a/tests/regrtest_data/ignore_option_10669/test/__init__.py b/tests/regrtest_data/ignore_option_10669/test/__init__.py index adc2b55bb9..268eb0f2d8 100644 --- a/tests/regrtest_data/ignore_option_10669/test/__init__.py +++ b/tests/regrtest_data/ignore_option_10669/test/__init__.py @@ -1,4 +1,4 @@ class i: """many issues here""" - pass \ No newline at end of file + pass