run method
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>[];
void emit(String? locale, ArbFile arb, String orphanKey) {
issues.add(
Issue(
severity: defaultSeverity,
ruleName: name,
message: '`@$orphanKey` has no matching key/value pair.',
locale: locale,
key: orphanKey,
file: arb.sourcePath,
line: arb.entryLines['@$orphanKey'],
hint:
'Either add a `$orphanKey` entry above this block, or '
'delete the orphan. `dialect check --fix` removes orphans '
'automatically.',
),
);
}
for (final orphanKey in project.source.orphanMetadata.keys) {
emit(null, project.source, orphanKey);
}
for (final entry in project.translations.entries) {
for (final orphanKey in entry.value.orphanMetadata.keys) {
emit(entry.key, entry.value, orphanKey);
}
}
return issues;
}