Showing 8 of 27 total issues
Method method_missing
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(name_as_symbol, *args, &block)
name = name_as_symbol.to_s
if name.end_with?('=')
is_readonly_field = readonly_fields.include?(name[0..-2])
- 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 find_by
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def find_by(attributes)
fail ArgumentError, '"attributes" expects a hash' unless attributes.is_a? Hash
filter(attributes).find do |netbox_object|
attributes.all? do |filter_key, filter_value|
- 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
return data[name] if data.is_a?(Hash) && data.key?(name)
Avoid too many return
statements within this method. Open
return true if data.is_a?(Hash) && data.key?(name)
Method initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(given_values = nil)
return self if given_values.nil?
if id_fields.count == 1 && !given_values.is_a?(Hash)
instance_variable_set(:"@#{id_fields.keys.first}", given_values)
- 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 respond_to_missing?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def respond_to_missing?(name_as_symbol, *args)
name = name_as_symbol.to_s
return false if name.end_with?('=') && readonly_fields.include?(name[0..-2])
return false if name.end_with?('=') && instance_variables.include?(name[0..-2])
- 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 page
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def page(page)
raise ArgumentError, "The offset '#{page}' is not numeric but has to be." unless page.is_a? Numeric
raise ArgumentError, "The offset '#{page}' must be integer but isn't." unless page.integer?
raise ArgumentError, "The offset '#{page}' must not be negative but is." if page.negative?
- 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update(new_values)
new_values.each do |attribute, values|
s_attribute = attribute.to_s
next if readonly_fields.include? s_attribute
- 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"