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>[];
for (final entry in project.source.entries) {
final pluralized = IcuMessage.pluralSelectors(entry.value);
for (final placeholder in _countPlaceholders(entry)) {
if (pluralized.contains(placeholder)) continue;
final noun = _wordAfter(entry.value, placeholder);
if (noun == null || !_looksPlural(noun)) continue;
issues.add(
Issue(
severity: defaultSeverity,
ruleName: name,
message:
'Source for `${entry.key}` puts the count `{$placeholder}` in '
'front of "$noun" with no plural block, so it renders '
'"1 $noun" when the count is 1.',
key: entry.key,
file: project.source.sourcePath,
line: project.source.entryLines[entry.key],
hint:
'Wrap it in an ICU plural: '
'`{$placeholder, plural, one{1 …} other{{$placeholder} …}}`. '
'Do it in the source — every translation inherits the shape, '
'and `plural_categories` then holds each locale to the '
'categories it needs. If "$noun" really does read correctly '
'at every count, run '
'`dialect check --ack $name:source:${entry.key}`.',
),
);
}
}
return issues;
}