check method

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

Implementation

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

  registry.addSwitchExpression((node) {
    if (_isNestedInSwitchExpression(node)) return;

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