lib/godmin/helpers/filters.rb
Method has too many lines. [29/25] Open
Open
def filter_select(name, options, html_options)
unless options[:collection].is_a? Proc
raise "A collection proc must be specified for select filters"
end
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for filter_select is too high. [19.34/15] Open
Open
def filter_select(name, options, html_options)
unless options[:collection].is_a? Proc
raise "A collection proc must be specified for select filters"
end
- 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
Method filter_select
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def filter_select(name, options, html_options)
unless options[:collection].is_a? Proc
raise "A collection proc must be specified for select filters"
end
Favor modifier unless
usage when having a single-line body. Another good alternative is the usage of control flow &&
/||
. Open
Open
unless options[:collection].is_a? Proc
- 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?