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.addSetOrMapLiteral((node) {
    final type = node.staticType;
    if (type == null) return;

    final isSet = _setChecker.isAssignableFromType(type);
    if (!isSet) return;

    final elements = node.elements.join(', ');
    reporter.atNode(node, _code, data: '[$elements]');
  });
}