ScanRunner class

Scans Dart files using saropa_lints rules without the plugin framework.

Issue cap: By default, ProgressTracker caps non-ERROR diagnostics at 500 for IDE Problems-tab performance. CLI tools that need complete output (accuracy report, audit) must pass disableIssueCap = true — otherwise rules silently appear "silent" after 500 issues are reached.

Constructors

ScanRunner({required String targetPath, List<String>? dartFiles, String? tier, Set<String>? enabledRuleNames, ScanMessageSink? messageSink, bool applyExclusionsToFileList = true, String? debugRule, bool excludeLightLane = false, bool bypassTierCap = false, RuleLane lane = RuleLane.full, bool laneStats = false, bool disableIssueCap = false, bool noExclude = false, List<String> excludeGlobs = const [], List<String> includeGlobs = const []})

Properties

applyExclusionsToFileList bool
When dartFiles is provided, whether to apply the same exclusions as directory discovery (e.g. .g.dart, build/). Default true.
final
bypassTierCap bool
Skips RuntimeTierCap.filterRuleSet() in _prepare(), allowing the full enabledRuleNames set to run uncapped. Used by the audit CLI which must exercise every rule regardless of the project's configured tier.
final
dartFiles List<String>?
Optional explicit list of Dart files to scan. When null or empty, files are discovered under targetPath.
final
debugRule String?
When set, emits per-node trace output for the named rule, showing type resolution details at each visited AST node.
final
disableIssueCap bool
Disables the IDE Problems-tab issue cap (ProgressTracker._maxIssues) so every diagnostic reaches the listener. The 500-issue default is designed for live IDE analysis, not CLI batch scans where completeness matters (accuracy report, audit). Without this, non-ERROR diagnostics are silently dropped after 500 issues and rules appear "silent".
final
enabledRuleNames Set<String>?
Optional explicit set of rule names to enable, bypassing both tier and the project config. Takes precedence over tier when both are set. Lets a caller exercise a rule set that no single tier expresses — notably the union of every defined rule including stylistic rules, which no tier (not even pedantic) contains. Used by the accuracy report so that stylistic-tier rules are actually run and not falsely reported as silent.
final
excludeLightLane bool
Drops light-lane rules from the scan's rule set.
final
hashCode int
The hash code for this object.
no setterinherited
lane RuleLane
Which lane the scan should use. Defaults to RuleLane.full so every enabled rule fires. Set to RuleLane.light via --lane light to restrict the scan to the same cheap, resolution-free subset the analysis server runs in its default lane.
final
laneStats bool
When true, prints how many rules are in the light lane vs full-only, making the lane gate's effect observable. Activated by --lane-stats.
final
messageSink ScanMessageSink?
Optional sink for all messages. When null, messages go to stdout and progress to stderr.
final
noExclude bool
When true, disables ALL hardcoded path exclusions (example/, build/, .dart_tool/, generated patterns, etc.) so every discovered .dart file is scanned. User-supplied --exclude-globs still apply.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
targetPath String
Project root: config is loaded from here and relative dartFiles are resolved against it.
final
tier String?
Optional tier name (e.g. essential, recommended, pedantic). When set, the rule set starts from this tier's union; the project's diagnostics: section (if present) is still layered on top, so a rule the user explicitly disabled stays disabled even though the tier includes it.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
run() List<ScanDiagnostic>?
Runs the default syntactic scan and returns all diagnostics found.
runResolved() Future<List<ScanDiagnostic>?>
Runs the scan with full type/element resolution and returns all diagnostics found. Returns null under the same no-config / unknown-tier conditions as run.
runResolvedWithCollection(AnalysisContextCollection collection) Future<List<ScanDiagnostic>?>
Runs the resolved scan for dartFiles against an already-built collection instead of creating a new one.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

buildProjectCollection(String projectRoot) AnalysisContextCollection
Builds an AnalysisContextCollection rooted at projectRoot for a long-lived caller (the scan daemon) to hold and reuse across many runResolvedWithCollection calls. This is the expensive step runResolved otherwise repeats on every invocation.
discoverDartFiles(String directory) List<String>
Public wrapper around _findDartFiles for callers that need the project's discovered file list up front (e.g. the scan daemon's listFiles request, which the IDE baseline scan uses to build chunked batches before issuing per-chunk resolved scans).