src/app/models/hardware_profile.rb
Method match_hardware_profile_property
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.match_hardware_profile_property(front_end_property, back_end_property)
# if the front_end_property is nil, we don't care about it, so everything matches:
return true if front_end_property.nil? || front_end_property.value.to_s.empty?
# if the back_end_property is nil, it only matches if front-end is also nil:
return false if back_end_property.nil? || back_end_property.value.to_s.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 generate_override_property_value
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.generate_override_property_value(front_end_property, back_end_property)
case back_end_property.kind
when "fixed"
return back_end_property.value
when "range"
- 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 match_hardware_profile_property
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.match_hardware_profile_property(front_end_property, back_end_property)
# if the front_end_property is nil, we don't care about it, so everything matches:
return true if front_end_property.nil? || front_end_property.value.to_s.empty?
# if the back_end_property is nil, it only matches if front-end is also nil:
return false if back_end_property.nil? || back_end_property.value.to_s.empty?
Avoid too many return
statements within this method. Open
Open
return value
Avoid too many return
statements within this method. Open
Open
return nil
Avoid too many return
statements within this method. Open
Open
return val