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 annotation = await getFirebaseRulesAnnotation(resolver);
  // This isn't a rules file
  if (annotation == null) return;

  context.registry.addFunctionDeclaration((node) {
    final parameters = node.functionExpression.parameters;
    if (parameters == null) return;

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