checker library

The static checker behind the tarpit command, for use from Dart code.

This library does not import Flutter.

Classes

Checker
Checks widget test files for code that can stall FakeAsync.
CheckResult
The outcome of a run.
Finding
One reported problem at a location in a test file.
Rule
A check tarpit runs on testWidgets bodies.

Enums

Severity
How serious a finding is.

Constants

allRules → const List<Rule>
Every rule, in documentation order.
assetString → const Rule
rootBundle.loadString, which decodes large assets on an isolate.
badSuppression → const Rule
A malformed tarpit:allow comment.
blockingSleep → const Rule
Blocking the isolate with sleep().
endlessSettle → const Rule
pumpAndSettle while an indeterminate progress indicator is on screen.
engineAsync → const Rule
Awaiting the engine's image pipeline outside runAsync.
exitClean → const int
Exit code: nothing at or above the --fail-on severity.
exitFindings → const int
Exit code: at least one finding at or above the --fail-on severity.
exitUsage → const int
Exit code: bad arguments, a missing path, or an internal error.
fakeDelay → const Rule
Awaiting a fake timer the test never advances.
isolateHop → const Rule
Awaiting another isolate outside runAsync.
packageVersion → const String
The package version; a test keeps it equal to pubspec.yaml.
realIo → const Rule
Awaiting dart:io work outside runAsync.

Functions

checkUnit(CompilationUnit unit, String source, String path, {required bool resolved}) → List<Finding>
Checks one parsed unit whose text is source, reporting it as path.
jsonReport(CheckResult result) → String
Machine-readable report, "format": "tarpit-json", "formatVersion": 1.
ruleById(String id) → Rule?
Looks up a rule by id.
rulesReport() → String
The rule list printed by tarpit --rules.
runCli(List<String> arguments, {StringSink? out, StringSink? err, String? workingDirectory, String? sdkPath}) → Future<int>
Runs the command line; returns the exit code.
sarifReport(CheckResult result) → String
SARIF 2.1.0 report, for GitHub code scanning and other viewers.
textReport(CheckResult result) → String
Human-readable report: one block per finding, the reason each rule exists (once per rule), then a summary line.

Exceptions / Errors

CheckerInputException
A path given to the checker does not exist or is not a Dart file.