class RuboCop::Cop::Metrics::AbcSize
And ‘AllowedPatterns` (defaults to `[]`)
This cop also takes into account `AllowedMethods` (defaults to `[]`)
end
render ’pages/search/page’
@posts = model.another_process(@posts, current_user)
@posts = model.some_process(@posts, current_user)<br>.search(params)
@posts = model.active.visible_by(current_user)
def search
# ‘CountRepeatedAttributes` is set to ’false’
# are each counted as only 1 branch each if
# ‘model` and `current_user`, referenced 3 times each,
@example CountRepeatedAttributes: false (default is true)
is meant to distinguish actual `attr_reader` from other methods.
For this purpose, attributes are any method with no argument; no attempt
You can have repeated “attributes” calls count as a single “branch”.
* > 30 dangerous
* 18..30 unsatisfactory
* <= 17 satisfactory
Interpreting ABC size:
and en.wikipedia.org/wiki/ABC_Software_Metric.
(method calls), and conditions. See c2.com/cgi/wiki?AbcMetric<br>configured maximum. The ABC size is based on assignments, branches
Checks that the ABC size of methods is not higher than the
def complexity(node)
def complexity(node) Utils::AbcSizeCalculator.calculate( node, discount_repeated_attributes: !cop_config['CountRepeatedAttributes'] ) end