Class Network
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Network
class << self
def has_reputation_for?(class_name, reputation_name)
reputation_def = get_reputation_def(class_name, reputation_name)
!!reputation_def[:source]
Method get_reputation_def
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_reputation_def(class_name, reputation_name)
reputation_def = {}
unless class_name == "ActiveRecord::Base"
reputation_defs = get_reputation_defs(class_name)
reputation_defs[reputation_name.to_sym] ||= {}
- 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 create_scoped_reputation_def
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_scoped_reputation_def(class_name, reputation_name, scope, options)
raise ArgumentError, "#{reputation_name} does not have scope." unless has_scopes?(class_name, reputation_name)
scope_options = options.reject { |k, v| ![:source, :aggregated_by].include? k }
reputation_def = get_reputation_def(class_name, reputation_name)
unless is_primary_reputation?(class_name, reputation_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 add_reputation_def
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_reputation_def(class_name, reputation_name, options)
reputation_defs = get_reputation_defs(class_name)
options[:source] = convert_to_array_if_hash(options[:source])
options[:source_of] ||= []
options[:source_of] = convert_to_array_if_hash(options[:source_of])
- 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"