Skip to content

Commit

Permalink
feat(A005): support detecting a shadowing folder
Browse files Browse the repository at this point in the history
fix #124
  • Loading branch information
asfaltboy committed Apr 8, 2024
1 parent 5b6dbff commit 74588e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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

0 comments on commit 74588e1

Please sign in to comment.