Showing 10 of 10 total issues
Method initialize_relationship
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def initialize_relationship(rel_model)
rel_model.reflect_on_all_associations(:belongs_to).each do |belongs_to|
return if belongs_to.options[:polymorphic]
# e.g. all has_many on User class
- 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 _neo_save
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _neo_save
return unless Neoid.enabled?
data = to_neo.merge(ar_type: self.class.name, ar_id: id, Neoid::UNIQUE_ID_KEY => neo_unique_id)
data.reject! { |k, v| v.nil? }
Method _neo_save
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _neo_save
return unless Neoid.enabled?
options = self.class.neoid_config.relationship_options
Method search
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def search(types, term, options = {})
options = options.reverse_merge(limit: 15, match_type: 'AND')
types = [*types]
Method to_neo
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def to_neo
if self.class.neoid_config.stored_fields
hash = self.class.neoid_config.stored_fields.inject({}) do |all, (field, block)|
all[field] = if block
instance_eval(&block)
- 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 search
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def search(types, term, options = {})
options = options.reverse_merge(limit: 15, match_type: 'AND')
types = [*types]
- 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 _neo_save
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _neo_save
return unless Neoid.enabled?
options = self.class.neoid_config.relationship_options
- 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_field_query
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def generate_field_query(field, term, fulltext = false, match_type = 'AND')
term = term.to_s if term
return '' if term.nil? || term.empty?
fulltext = fulltext ? '_fulltext' : nil
- 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 _neo_save
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _neo_save
return unless Neoid.enabled?
data = to_neo.merge(ar_type: self.class.name, ar_id: id, Neoid::UNIQUE_ID_KEY => neo_unique_id)
data.reject! { |k, v| v.nil? }
- 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 process_results
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_results(results)
results.map! do |result|
return result unless result.is_a?(Hash) && result['self'] && result['self'][%r[^https?://.*/(node|relationship)/\d+]]
type = case $1
- 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"