Skip to content

Pylint skipping similarly named project directory. #10969

@cinnion

Description

@cinnion

Bug description

In working on my project, I found that there was a discrepancy between the number of files being checked and how many files I had in my project, which includes both a `applications` and a `applications_api` module. In single stepping through `PyLinter._discover_files()`, I found that it would first walk over `applications`, add it to the `skip_subtrees` list, then when it hit the `applications_api` module, it would falsely skip it as having already been discovered.

Given that both of these are directories which include an `__init__.py` file, the solution is to append the OS directory separator to the name when appending the directory to the `skip_subtrees` list on line 688. I will be following this up with a PR with that fix.

The URL for my project is https://github.com/cinnion/job-application-tracker and I am running tests against the version tagged v1.99.1.

Configuration

[tool.pylint.main]
django-settings-module="job_application_tracker.settings"
load-plugins = [
    "pylint_django",
    "pylint_per_file_ignores",
]
max-line-length = 120
ignore = [
    ".git",
    ".venv",
    "__pycache__",
    "manage.py",
    "node_modules"
]
jobs = 0
recursive = true
source-roots = "."

Command used

pylint --verbose --recursive=y .

or

pylint --verbose --recursive=y $(git ls-files '*.py')

Pylint output

For the command `pylint --verbose --recursive=y .`, the output is as follows (less the fixmes):


(.venv) [cinnion@wing-1 job-application-tracker]$ pylint --verbose --recursive=y .
Using config file /home/cinnion/git.github/job-application-tracker/pyproject.toml

-----------------------------------------------------------------------------------------------------------------------
Your code has been rated at 9.98/10 (previous run: 9.98/10, +0.00)
Checked 43 files/modules (), skipped 0 files/modules



With the command `pylint --verbose --recursive=y $(git ls-files '*.py')`, the output is as follows:


(.venv) [cinnion@wing-1 job-application-tracker]$ pylint --verbose --recursive=y $(git ls-files '*.py')
Using config file /home/cinnion/git.github/job-application-tracker/pyproject.toml

-----------------------------------------------------------------------------------------------------------------------
Your code has been rated at 9.98/10 (previous run: 9.98/10, +0.00)
Checked 58 files/modules (), skipped 3 files/modules

Expected behavior

I would have expected more than 43 files to have been checked in the first case. In debugging, I tracked down 6 files as being "legitimately" skipped, due to an undocumented behaviour of pylint-django adding "migrations" to the ignore list, but that still leaves 9 files being missed, which is directly attributable to it skipping applications_api in the walk of the tree in _discover_files(). This has been verified after I added my fix for issue #10968 to the code.

Pylint version

pylint 4.0.5
astroid 4.0.4
Python 3.13.12 (main, Feb  4 2026, 00:00:00) [GCC 11.5.0 20240719 (Red Hat 11.5.0-11)]

OS / Environment

RHEL 9.7 and Rocky 9.7

Additional dependencies

Please see my project at https://github.com/cinnion/job-application-tracker

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🪲Needs investigation 🔬A bug or crash where it's not immediately obvious what is happenning

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions