Skip to content

Fix for issue #10969 - Pylint skipping similarly named project direct…#10970

Open
cinnion wants to merge 1 commit intopylint-dev:mainfrom
cinnion:bugfix-10969
Open

Fix for issue #10969 - Pylint skipping similarly named project direct…#10970
cinnion wants to merge 1 commit intopylint-dev:mainfrom
cinnion:bugfix-10969

Conversation

@cinnion
Copy link
Copy Markdown

@cinnion cinnion commented Apr 14, 2026

This fix is to PyLinter._discover_files(). It will falsely ignore a with a name like applications_api after having previously walking across one named applications. The fix was to add the os directory separator to the end of what is a known directory (because of the fact that it has a file named __init__.py in it).

Type of Changes

| ✓ | 🐛 Bug fix |

Description

This fix is to PyLinter._discover_files(). It will falsely ignore a with a name like applications_api after having previously walking across one named applications. The fix was to add the os directory separator to the end of what is a known directory (because of the fact that it has a file named __init__.py in it).

I have run the test suites, and while there are failing tests, I have verified that those were failing before my fix. I have also written a towncrier for this fix, and followed what seems to be a convention of removing the .rst extension from the file.

Lastly, _discover_files() is currently not under test. Because of its nature of traversing a filesystem and the project's use of pytest, we would be doing some pretty serious setup and mocking to test this. Doable, yes... but involved. If such testing is a gating criteria for this PR, please contact me on the Discord server to discuss where to put them, etc.

Closes #10969

…ect directory.

- Because _discover_files() will falsely ignore a with a name like
  `applications_api` after walking across one named `applications`, add
  the os directory separator to the end of what is a known directory
  (because of the fact that it has a file named `__init__.py` in it).
Copy link
Copy Markdown
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do the same on line 684?

I agree with the difficuly of testing this. It is unfortunate but the fix makes sense to me.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.18%. Comparing base (34b7ec5) to head (6fed3d7).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #10970   +/-   ##
=======================================
  Coverage   96.18%   96.18%           
=======================================
  Files         178      178           
  Lines       19662    19662           
=======================================
  Hits        18911    18911           
  Misses        751      751           
Files with missing lines Coverage Δ
pylint/lint/pylinter.py 96.29% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown
Contributor

🤖 According to the primer, this change has no effect on the checked open source code. 🤖🎉

This comment was generated for commit 6fed3d7

@cinnion
Copy link
Copy Markdown
Author

cinnion commented Apr 15, 2026

Should we do the same on line 684?

While at first it might make sense, we cannot guarantee that it is a directory. That is why I did not add it there. But, sitting here, thinking about it, we might want to. Perhaps it is worthy of a discussion on Discord?

I agree with the difficuly of testing this. It is unfortunate but the fix makes sense to me.

Out of curiosity, a question. Where specifically would we put such a test? Would there be a file under tests/lint which already exists to which I would add such tests, would it be a new file there, or perhaps a new file under tests/functional/d?

@Pierre-Sassoulas Pierre-Sassoulas added this to the 4.0.6 milestone Apr 17, 2026
@DanielNoord
Copy link
Copy Markdown
Collaborator

While at first it might make sense, we cannot guarantee that it is a directory. That is why I did not add it there. But, sitting here, thinking about it, we might want to. Perhaps it is worthy of a discussion on Discord?

Why can we for the other case?

Out of curiosity, a question. Where specifically would we put such a test? Would there be a file under tests/lint which already exists to which I would add such tests, would it be a new file there, or perhaps a new file under tests/functional/d?

cinnion@6ad350f#diff-b6fcc07dde118fad26a433effbf0190d06193fbf57599f5e0619dd449cefdb9b has some examples for this I think :)

It was one of the most recent changes to these lines, which also added tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pylint skipping similarly named project directory.

3 participants