validateCandidate method

OkfSpecValidation validateCandidate(
  1. OkfBundle candidate, {
  2. Iterable<String> replacedPaths = const <String>[],
})

Validates a prospective complete candidate while retaining source load failures except those repaired by replacedPaths.

This is the same Report-composition seam as validate, used when a caller has overlaid changes in memory without re-reading the filesystem.

Implementation

OkfSpecValidation validateCandidate(
  OkfBundle candidate, {
  Iterable<String> replacedPaths = const <String>[],
}) {
  final replacements = replacedPaths.toSet();
  final validation = const OkfSpecValidator().validate(candidate);
  return OkfSpecValidation(
    OkfReport(
      findings: <OkfFinding>[
        ...report.findings.where(
          (finding) => !replacements.contains(finding.location?.path),
        ),
        ...validation.report.findings,
      ],
    ),
  );
}