run method
void
run(
- CustomLintResolver resolver,
- ErrorReporter reporter,
- CustomLintContext context
Emits lints for a given file.
run will only be invoked with files respecting filesToAnalyze
Implementation
@override
void run(
CustomLintResolver resolver,
ErrorReporter reporter,
CustomLintContext context,
) {
final options = _retrieveCharsLimit(configs);
context.registry.addCompilationUnit(
(node) {
if (node.length <= 0) return;
final linesData = mapOffsetsToListLengths(node.lineInfo.lineStarts, node.length);
for (final lineData in linesData) {
if (lineData.lineLength > options.charsLimit) {
reporter.reportErrorForOffset(
code,
lineData.startOffset,
lineData.lineLength,
);
}
}
},
);
}