check method

  1. @override
void check(
  1. DcqRegistry registry
)

Implementation

@override
void check(
  DcqRegistry registry,
) {
  registry.addMethodInvocation((node) {
    final name = node.methodName.name;
    if (name != 'test' && name != 'testWidgets') return;

    AstNode? current = node.parent;
    while (current != null) {
      if (current is MethodInvocation && current.methodName.name == 'group') {
        return;
      }
      if (current is FunctionDeclaration || current is MethodDeclaration) {
        break;
      }
      current = current.parent;
    }

    reportAtNode(node.methodName);
  });
}