run method

  1. @override
List<Issue> run(
  1. DialectProject project
)
override

Inspect project and return findings. May return an empty list. Should NOT throw — turn unexpected conditions into Issues so the report surfaces them rather than crashing.

Implementation

@override
List<Issue> run(DialectProject project) {
  final raw = project.config.extras['toolchain'];
  if (raw is! Map) return const [];
  final declared = raw['min_version'];
  if (declared == null) return const [];

  final floor = _parse(declared.toString());
  final running = _parse(runningVersion);
  // An unparseable version on either side is not this rule's business to
  // adjudicate — staying silent beats inventing a failure from a typo.
  if (floor == null || running == null) return const [];
  if (!_isOlder(running, floor)) return const [];

  return [
    Issue(
      severity: defaultSeverity,
      ruleName: name,
      message:
          'This project requires Dialect ${declared.toString()} or newer, '
          'but the binary on PATH is $runningVersion.',
      file: p.join(project.root, 'dialect', 'dialect.yaml'),
      hint:
          'Upgrade the CLI (see the install steps in the README), then '
          're-run. If the floor is wrong, lower `toolchain.min_version` in '
          'dialect.yaml — but only after checking the newer behavior the '
          'project relies on, since an older binary can silently do the '
          'wrong thing rather than refuse.',
    ),
  ];
}