darcyWeb/app/helpers/admin_helper.rb
Assignment Branch Condition size for options_for_levels_with_plans is too high. [16.61/15] Open
Open
def options_for_levels_with_plans(plans, building, selected_level)
options = []
plans.each do |plan|
display = "#{plan.building.acronym} - NĂvel #{plan.level}"
selected = false
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Line is too long. [148/100] Open
Open
options.push([display, plan.building.id, { data: { selected: selected, level: plan.level, image: plan.image_url, geo_data: plan.geo_data } }])
- Exclude checks
Favor modifier if
usage when having a single-line body. Another good alternative is the usage of control flow &&
/||
. Open
Open
if plan.building == building && plan.level == selected_level
- Read upRead up
- Exclude checks
Checks for if and unless statements that would fit on one line
if written as a modifier if/unless. The maximum line length is
configured in the Metrics/LineLength
cop.
Example:
# bad
if condition
do_stuff(bar)
end
unless qux.empty?
Foo.do_something
end
# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?