Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow linting directories without __init__.py #3569

Merged
merged 1 commit into from
May 2, 2020
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
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ Release date: TBA

Close #3524

* Allow linting directories without `__init__.py` which was a regression in 2.5.

Close #3528

What's New in Pylint 2.5.0?
===========================

Expand Down
2 changes: 1 addition & 1 deletion pylint/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def expand_modules(files_or_modules, black_list, black_list_re):
continue

module_path = get_python_path(something)
additional_search_path = [module_path] + path
additional_search_path = [".", module_path] + path
if os.path.exists(something):
# this is a file or a directory
try:
Expand Down
15 changes: 15 additions & 0 deletions tests/test_self.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,3 +763,18 @@ def test_allow_import_of_files_found_in_modules_during_parallel_check(self, tmpd
],
code=0,
)

def test_can_list_directories_without_dunder_init(self, tmpdir):
test_directory = tmpdir / "test_directory"
test_directory.mkdir()
spam_module = test_directory / "spam.py"
spam_module.write("'Empty'")

with tmpdir.as_cwd():
self._runtest(
[
"--disable=missing-docstring, missing-final-newline",
"test_directory",
],
code=0,
)