File updater.rb
has 343 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Chouette
module Sync
class Updater
include Measurable
Method update_custom_fields
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update_custom_fields(model, resource, event)
return unless resource.respond_to?(:custom_fields_attributes)
resource.custom_fields_attributes.each do |custom_field_attributes|
code = custom_field_attributes[:code]
- 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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(reference_type, resource_ids, model_id_attribute, code_space, updater)
Method update_codes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_codes(model, resource, event)
return unless model.respond_to?(:codes) && resource.respond_to?(:codes_attributes)
resource.codes_attributes.each do |code_attributes|
short_name = code_attributes[:short_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 identifiers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def identifiers
return [] if resource_ids.empty? || !model_ref
ids = if support_model_id_attribute?
model_ref.where(model_id_attribute => resource_ids).pluck(: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"