runSeamAudits function
int
runSeamAudits({
- required List<
SeamAudit> audits, - required String repositoryRoot,
- required String workspaceRoot,
- required String holds,
- bool quiet = false,
- StringSink? out,
- StringSink? err,
Runs audits in order against repositoryRoot and workspaceRoot and
prints one line per audit to out — ok <label>, or FAIL <label>
with each violation under it — then holds when nothing crossed a
boundary. With quiet, passing audits and the roots are not printed.
Returns the exit code a command ends with: 0 when every audit holds, 1
when at least one boundary is crossed (the count goes to err).
Implementation
int runSeamAudits({
required List<SeamAudit> audits,
required String repositoryRoot,
required String workspaceRoot,
required String holds,
bool quiet = false,
StringSink? out,
StringSink? err,
}) {
final o = out ?? stdout;
final e = err ?? stderr;
if (!quiet) {
o
..writeln('repository root: $repositoryRoot')
..writeln('workspace root: $workspaceRoot')
..writeln();
}
var failed = 0;
for (final audit in audits) {
final violations = audit.run(repositoryRoot, workspaceRoot);
failed += violations.length;
if (violations.isEmpty) {
if (!quiet) o.writeln('ok ${audit.label}');
continue;
}
o.writeln('FAIL ${audit.label}');
for (final violation in violations) {
o.writeln(' ${violation.message}');
}
}
if (failed > 0) {
e.writeln('\n$failed package-boundary violation(s).');
return 1;
}
if (!quiet) o.writeln('\n$holds');
return 0;
}