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,
) async {
  final resolved = await resolver.getResolvedUnitResult();
  context.sharedState;

  context.registry.addFunctionDeclaration((node) {
    final annotation = getFirebaseRulesAnnotation(resolved);
    // This isn't a rules file
    if (annotation == null) return;

    final parameters = node.functionExpression.parameters;
    if (parameters == null) return;

    final parameterElements =
        parameters.parameterElements.whereType<ParameterElement>();
    if (parameterElements.where((e) => e.isNamed).isNotEmpty) {
      reporter.deprecatedReportErrorForNode(_code, parameters);
      return;
    }
  });
}