Showing 33 of 40 total issues
Method field_method
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def field_method(field_name, options, body, args, block)
Method parse_initial_value
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_initial_value(cell)
return if empty?(cell)
Integer(cell)
rescue
error "invalid value for initial value: #{cell.inspect}"
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method merge_code_block
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def merge_code_block(other_block)
other_block.lines.each_with_index do |line, i|
line.indent += @indent
if i.zero?
@lines.last.indent = line.indent if last_line_empty?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method enable
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def enable(item_or_items)
Array(item_or_items).each do |item|
next unless @items.key?(item)
next if @enabled_items.include?(item)
@enabled_items << item
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
parameter? && (return true)
Method check_start_end_adderss_relation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_start_end_adderss_relation(cell)
return if start_address < end_address
return if [configuration.byte_width, byte_size].all? { |v| v == 1 }
error "start address is equal to or greater than end address: #{cell}"
end
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method []
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def [](array_index_or_msb, lsb = array_index_or_msb)
if array_index_or_msb.nil?
self
else
new_name =
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method model_creation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def model_creation(code)
foreach_header(code) if array?
code << subroutine_call('`rggen_ral_create_reg_model', arguments) << nl
foreach_footer(code) if array?
end
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method address_code
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def address_code(address)
base = hex(address, local_address_width)
if register.array? && register.multiple?
increment_value = hex(byte_width, local_address_width)
"#{base} + #{increment_value} * #{local_index}"
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method rights
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def rights
return string(:RO) if register.read_only?
return string(:WO) if register.write_only?
string(:RW)
end
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method convert
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def convert(cell)
[:default, *@target_items.keys].find_yield do |t|
case cell
when /\A#{t}(?::(.+))?\Z/im
cell_value.new(t, Regexp.last_match.captures[0])
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method def_single_delegator
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def def_single_delegator(accessor, method, ali = method)
accessor = accessor.to_s
if method_defined?(accessor) || private_method_defined?(accessor)
accessor = "#{accessor}()"
end if self.class === Module
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method cell_blocks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def cell_blocks(sheet)
drop_row_size = active_item_factories.size + 2
drop_column_size = 1
sheet.rows.drop(drop_row_size).each_with_object([]) do |row, blocks|
valid_cells = row.drop(drop_column_size)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"