Showing 3 of 12 total issues
Class Service
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Service
extend MatchMethodMacros
attr_accessor :config
Method process_attrs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def process_attrs(attrs)
attrs = attrs.symbolize_keys
self.class.properties.delete_if{|p| p == :node_id}.each do |property|
if property == :active_record_id
process_attr(property, attrs[:id].present? ? attrs[:id] : attrs[:active_record_id])
- 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 traverse_path_properties
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def traverse_path_properties
# :order - breadth_first or depth_first
# :relationships - all, in, or out
# e.g. [{"type" => "likes", "direction" => "all}]
# :uniqueness - node_global, none, relationship_global, node_path, or relationship_path
- 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"