Assignment Branch Condition size for register_class is too high. [16.61/15] Open
def register_class klass, hash
klass.config = hash.merge class: klass
prefix_index = hash[:idx_char] || :default
# ^ this is gross and needs to be moved out.
- Read upRead up
- Create a ticketCreate a ticket
- 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
Replace class var @@prefix_map_by_chunkname with a class instance var. Open
@@prefix_map_by_chunkname = {}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.
Replace class var @@raw_list with a class instance var. Open
@@raw_list = {}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.
Replace class var @@prefix_regexp_by_list with a class instance var. Open
@@prefix_regexp_by_list = {}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.
Replace class var @@prefix_map_by_list with a class instance var. Open
@@prefix_map_by_list = Hash.new { |h, k| h[k] = {} }
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.
Use a guard clause instead of wrapping the code inside a conditional expression. Open
unless raw_list.key? chunk_list_key
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Use a guard clause instead of wrapping the code inside a conditional expression
Example:
# bad
def test
if something
work
end
end
# good
def test
return unless something
work
end
# also good
def test
work if something
end
# bad
if something
raise 'exception'
else
ok
end
# good
raise 'exception' if something
ok