Skip to content

symfonic.devtools.archgate.sourcefacts

sourcefacts

Extra static facts the DRY rules need, in one AST pass per module.

symfonic.devtools.archcheck.scan records imports, sizes, and export surfaces — everything the T1.2.4 rules ask of a module. The DRY rules ask two more questions: what does this module define at top level (so a second copy of the normalizer is visible) and what does it rebind at runtime (so process-global mutable state is visible). Both are answered here, from the paths scan_source_tree already resolved, so a module is parsed once.

Definition dataclass

Definition(name: str, lineno: int, kind: str)

A top-level def/async def/class in a module.

GlobalBinding dataclass

GlobalBinding(name: str, lineno: int, function: str)

A global statement: module state rebound from inside a function.

collect_facts

collect_facts(modules: dict[str, ModuleInfo]) -> dict[str, ModuleFacts]

Parse every scanned module into its DRY-relevant facts.

Source code in src/symfonic/devtools/archgate/sourcefacts.py
def collect_facts(modules: dict[str, ModuleInfo]) -> dict[str, ModuleFacts]:
    """Parse every scanned module into its DRY-relevant facts."""
    return {name: module_facts(info) for name, info in modules.items()}