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 issues = <Issue>[];
  for (final entry in project.translations.entries) {
    final locale = entry.key;
    if (locale == project.config.sourceLocale) continue;
    final arb = entry.value;
    for (final t in arb.entries) {
      final meta = t.metadata;
      if (meta == null || !meta.locked) continue;
      if (meta.sourceHash != null && meta.sourceHash!.isNotEmpty) continue;
      issues.add(
        Issue(
          severity: defaultSeverity,
          ruleName: name,
          message:
              'Lock on `${t.key}` records no source_hash — a bare lock '
              'cannot say what it approved.',
          locale: locale,
          key: t.key,
          file: arb.sourcePath,
          line: arb.entryLines[t.key],
          hint:
              'Run `dialect lock ${t.key} --locale $locale` to re-lock it with the '
              'hash stamped (or re-lock in `dialect serve`), so later '
              'source edits surface as locked + stale instead of shipping '
              'silently.',
        ),
      );
    }
  }
  return issues;
}