validateProject function

Future<ValidationOutcome> validateProject({
  1. required String projectRoot,
  2. List<CommandRecord> commands = gates.validationCommands,
  3. GateRunner? runGates,
  4. ProtectedHasher hashProtected = protected.hashProtected,
})

Implementation

Future<ValidationOutcome> validateProject({
  required String projectRoot,
  List<CommandRecord> commands = gates.validationCommands,
  GateRunner? runGates,
  ProtectedHasher hashProtected = protected.hashProtected,
}) async {
  final before = hashProtected(projectRoot);
  final outcome =
      await (runGates ??
          () => gates.runGates(
            projectRoot: projectRoot,
            commandsToRun: commands,
          ))();
  final after = hashProtected(projectRoot);
  final violations = protected.protectedViolations(
    before: before,
    after: after,
  );
  final result = outcome.passed && violations.isEmpty
      ? ValidationResult.passed
      : ValidationResult.failed;
  return ValidationOutcome(
    report: ValidationReport(
      commands: outcome.commands,
      exitCodes: outcome.exitCodes,
      outputs: outcome.outputs,
      protectedHashesBefore: before,
      protectedHashesAfter: after,
      result: result,
    ),
    violations: violations,
  );
}