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

feat(A005): support detecting a shadowing folder #125

Merged
merged 2 commits into from Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion flake8_builtins.py
Expand Up @@ -293,7 +293,10 @@ def check_module_name(self, filename: str):
if not self.module_names:
return
path = Path(filename)
module_name = path.name.removesuffix('.py')
if path.name == '__init__.py':
module_name = path.parent.name
else:
module_name = path.name.removesuffix('.py')
if module_name in self.module_names:
yield self.error(
None,
Expand Down
1 change: 1 addition & 0 deletions run_tests.py
Expand Up @@ -510,6 +510,7 @@ def test_tuple_unpacking():
def test_module_name():
source = ''
check_code(source, expected_codes='A005', filename='./temp/logging.py')
check_code(source, expected_codes='A005', filename='./temp/typing/__init__.py')


@pytest.mark.skipif(
Expand Down