run method

Runs the default syntactic scan and returns all diagnostics found.

Returns null if no configuration was found and no tier was set (caller should tell the user to run init first), or if tier was set to an unknown value.

This is a purely syntactic pass (parseString, no resolution): it is fast, but rules registered on addInstanceCreationExpression and any type-based rule under-report — see runResolved for the resolved path.

Implementation

List<ScanDiagnostic>? run() {
  // Reset per-run state for symmetry with the resolved paths — the
  // syntactic pass never calls contextFor so skips can't happen today,
  // but a reused ScanRunner must start clean regardless.
  _skippedFileCount = 0;
  final cap = _applyIssueCap();
  final plan = _prepare();
  if (plan == null) return null;
  if (plan.files.isEmpty) return const [];

  final registrations = _registerRules(
    plan.rules,
    () => ScanRuleContext(definingUnit: _dummyContextUnit()),
  );
  final result = _scanFiles(plan.files, registrations);
  _noteIssueCap(cap);
  return result;
}