Skip to content

symfonic.diagnostics.inspection.runner

runner

Run every offline inspector, and say which ones could not run.

The runner owns one judgement the inspectors deliberately do not: whether an input was supplied at all. An inspector handed nothing would have to choose between returning "clean" and inventing a finding, and both are wrong -- so it is never handed nothing. A category with no input is recorded in skipped with the reason, and a report that says "not inspected: no configuration mapping" is worth more than a green tick that meant nobody looked.

inspect_migration

inspect_migration(context: InspectionContext) -> MigrationInspection

Answer all migration questions, reading nothing but text.

Source code in src/symfonic/diagnostics/inspection/runner.py
def inspect_migration(context: InspectionContext) -> MigrationInspection:
    """Answer all migration questions, reading nothing but text."""
    probe = probe_config(context.config)
    findings, skipped = _config_findings(context, probe)

    if context.project_root is None:
        skipped["deprecated-import"] = _NO_SOURCES
        skipped["architecture-violation"] = _NO_SOURCES
        refs = ()
    else:
        refs = project_imports(context)
        findings += deprecated_imports(refs)
        findings += architecture_violations(context, refs)

    # An empty environment and one that names no deployment are the same answer:
    # every platform check below is silent for both, so reporting either as
    # "inspected" hands back a green tick for a gate nobody looked at.
    if not describes_a_deployment(context.environ):
        skipped["platform-security"] = _NO_DEPLOYMENT
    else:
        findings += platform_security(context.environ, refs)

    inspected = tuple(name for name in CATEGORIES if name not in skipped)
    return MigrationInspection(
        findings=tuple(sorted(findings, key=lambda f: f.sort_key)),
        inspected=inspected,
        skipped=tuple(
            (name, skipped[name]) for name in CATEGORIES if name in skipped
        ),
    )