check method

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

Implementation

@override
void check(
  DcqRegistry registry,
) {
  final acceptableLevel = configInt(ruleConfig, 'acceptable-level') ?? 1;

  registry.addConditionalExpression((node) {
    if (_isNestedInConditional(node)) return;

    final depth = _maxDepth(node);
    if (depth > acceptableLevel) {
      reportAtNode(node);
    }
  });
}