run method

Runs the check, returning one violation per breach.

Implementation

@override
List<CodeSpecsViolation> run(CodeSpecsValidationInput input) {
  if (input.extracts.isEmpty) return const [];
  final out = <CodeSpecsViolation>[];
  for (final declaration in input.declarations) {
    for (final sectionId in csCitedSectionIdsOf(declaration)) {
      if (input.extracts.knowsSection(sectionId)) continue;
      out.add(
        fail(
          '${declaration.path} traces to $sectionId, which no extract holds '
          '— a back-link to a token no area routed is either a stale id or '
          'one written to satisfy §2.5, and neither states where the code '
          'came from',
          declaration.location,
          sectionId,
        ),
      );
    }
  }
  return out;
}