Skip to content

no-dunder-all

modules should not define or mutate __all__

Why

__all__ creates a second, mutable wildcard-import surface that can drift from runtime bindings; Sarj code uses explicit imports and private-name conventions instead.

Fix

Before deleting __all__, replace wildcard-import consumers with explicit imports, retain each intended binding, and prefix implementation-only bindings with _. Use self-aliased imports to mark intentional facade re-exports to static tooling. For a whole-module compatibility alias, replace the entry in sys.modules and migrate maintained consumers to the canonical path instead of copying every name.

Examples

Before — flagged Do not repeat an explicit re-export list
diagnostics/__init__.py
from .models import Diagnostic as Diagnostic
__all__ = ["Diagnostic"]
After — preferred Make the re-export explicit in the import
diagnostics/__init__.py
from .models import Diagnostic as Diagnostic