Merge pull request #279 from AIOSAI/seedgo/fix-init-py-false-positives
fix(seedgo): __init__.py false positives in imports + naming
This commit is contained in:
@@ -57,6 +57,15 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
|
||||
checks = []
|
||||
path = Path(module_path)
|
||||
|
||||
# Python package marker — no imports required by convention
|
||||
if path.name == '__init__.py':
|
||||
return {
|
||||
'passed': True,
|
||||
'checks': [{'name': 'Package marker', 'passed': True, 'message': '__init__.py — Python package marker, no import checks'}],
|
||||
'score': 100,
|
||||
'standard': 'IMPORTS'
|
||||
}
|
||||
|
||||
if is_bypassed(module_path, 'imports', bypass_rules=bypass_rules):
|
||||
return {
|
||||
'passed': True,
|
||||
|
||||
@@ -146,6 +146,14 @@ def check_file_naming(module_path: str, path: Path) -> Dict:
|
||||
"""
|
||||
filename = path.stem # filename without extension
|
||||
|
||||
# Python-reserved package marker — cannot be renamed
|
||||
if path.name == '__init__.py':
|
||||
return {
|
||||
'name': 'File naming',
|
||||
'passed': True,
|
||||
'message': '__init__.py (Python-reserved package marker)'
|
||||
}
|
||||
|
||||
# Check if it's the documented exception
|
||||
if filename == 'json_handler' and '/handlers/json/' in module_path:
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user