Sha256: d89ec02fe9807b257ebe3b149cd558ea0d5a8bc1308fab1ca06c5c9bfec66db9
Contents?: true
Size: 740 Bytes
Versions: 1
Compression:
Stored size: 740 Bytes
Contents
# encoding: utf-8 module RuboCop module Cop # This module handles measurement and reporting of complexity in methods. module MethodComplexity include OnMethod include ConfigurableMax private def on_method(node, method_name, _args, _body) max = cop_config['Max'] complexity = complexity(node) return unless complexity > max add_offense(node, :keyword, format(self.class::MSG, method_name, complexity, max)) do self.max = complexity end end def complexity(node) c = 1 on_node(self.class::COUNTED_NODES, node) do |n| c += complexity_score_for(n) end c end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.25.0 | lib/rubocop/cop/mixin/method_complexity.rb |