diff --git a/doc/whatsnew/fragments/10969.bugfix b/doc/whatsnew/fragments/10969.bugfix new file mode 100644 index 0000000000..e8584fb235 --- /dev/null +++ b/doc/whatsnew/fragments/10969.bugfix @@ -0,0 +1,7 @@ +Fix an issue where discovery can miss a similarly named directory if a shorter named directory is processed first. + +If you have directories named say `applications` and `applications_api` in a +project, and the former is encountered by the tree walk first during discovery, +the second directory would be skipped even if it was a valid package. This fixes +the issue by appending the OS filepath separator to the name in the case where +the path was known to be a directory due to having an `__init__.py` in it. diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py index d3399ecba4..101cbbcdd2 100644 --- a/pylint/lint/pylinter.py +++ b/pylint/lint/pylinter.py @@ -685,7 +685,7 @@ def _discover_files(self, files_or_modules: Sequence[str]) -> Iterator[str]: continue if "__init__.py" in files: - skip_subtrees.append(root) + skip_subtrees.append(root + os.sep) yield root else: yield from (