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.addMethodInvocation((node) {
    // Check if this is a App.button() call
    if (!_isAppMethod(node, 'button')) return;

    // Find the label argument
    final labelArg = _findNamedArgument(node, 'label');
    if (labelArg == null) return;

    // Check if it's an empty string
    if (labelArg is StringLiteral &&
        labelArg.stringValue?.trim().isEmpty == true) {
      reporter.atNode(labelArg, code);
    }
  });
}