check method

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

Implementation

@override
void check(
  DcqRegistry registry,
) {
  final threshold = configInt(ruleConfig, 'threshold') ?? _defaultThreshold;

  registry.addIfStatement((node) {
    if (_countBooleanOperators(node.expression) > threshold) {
      reportAtNode(node.expression);
    }
  });

  registry.addWhileStatement((node) {
    if (_countBooleanOperators(node.condition) > threshold) {
      reportAtNode(node.condition);
    }
  });

  registry.addDoStatement((node) {
    if (_countBooleanOperators(node.condition) > threshold) {
      reportAtNode(node.condition);
    }
  });
}