1.5 KiB
1.5 KiB
Audit scripts that classify or summarize must have a --strict quality gate that exits 1 on regression
What it says
Every audit script in scripts/audit_*.py that produces classified output (weak types, exception handling, tier2 leaks, etc.) MUST implement a --strict mode that exits non-zero when the audit finds violations. The default mode (no --strict) is informational — it prints a human-readable report and exits 0. The --strict mode is the CI gate.
Why
An audit without a gate is a suggestion. An audit with a --strict gate is a convention enforced before merge. The project's 4 existing audit scripts (audit_weak_types.py, audit_exception_handling.py, audit_main_thread_imports.py, audit_no_models_config_io.py) all follow this pattern. New audit scripts MUST follow it too.
The pattern
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--strict", action="store_true", help="Exit 1 on any violation")
parser.add_argument("--json", action="store_true", help="Machine-readable output")
args = parser.parse_args()
violations = run_audit()
if args.json:
print(json.dumps(violations))
else:
print_human_report(violations)
if args.strict and violations:
return 1
return 0
See also
conductor/directives/convention_enforcement_4_mechanisms— the 4-mechanism enforcement model (styleguide + checklist + audit script + CI gate)conductor/directives/quality_gate_catches_broken_classifier_before_ship— the quality gate for classifier scripts