run method

  1. @override
void run(
  1. CustomLintResolver resolver,
  2. ErrorReporter reporter,
  3. 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,
) {
  context.registry.addRegularComment((token) {
    if (_commentErrorOffset(token) case final contentStart?) {
      reporter.reportErrorForOffset(
        _createCode(_CommentType.comment),
        token.offset + contentStart,
        0,
      );
    }
  });

  context.registry.addComment((node) {
    for (final token in node.tokens) {
      if (_commentErrorOffset(token) case final contentStart?) {
        reporter.reportErrorForOffset(
          _createCode(_CommentType.doc),
          token.offset + contentStart,
          0,
        );
      }
    }
  });
}