run method

  1. @override
void run(
  1. CustomLintResolver resolver,
  2. DiagnosticReporter 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,
  DiagnosticReporter reporter,
  CustomLintContext context,
) {
  context.registry.addMethodInvocation((node) {
    if (node.parent is VariableDeclaration ||
        !node.methodName.name.toLowerCase().endsWith('of') ||
        node.argumentList.arguments.length != 1 ||
        node.argumentList.arguments.first.toSource() != 'context') {
      return;
    }

    reporter.atNode(node, _code);
  });
}