Class Referential
has 92 methods (exceeds 20 allowed). Consider refactoring. Open
class Referential < ApplicationModel
prepend ReferentialSaveWithLock
include DataFormatEnumerations
include ObjectidFormatterSupport
File referential.rb
has 647 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ReferentialSaveWithLock
def save(options = {})
super(options)
rescue ActiveRecord::StatementInvalid => e
Chouette::Safe.capture "Referential #{name} with slug #{slug} save failed", e
Method force_register_models_with_checksum
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def self.force_register_models_with_checksum
paths = Rails.application.paths['app/models'].to_a
Rails.application.railties.each do |tie|
next unless tie.respond_to? :paths
paths += tie.paths['app/models'].to_a
- 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 switch
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def switch(verbose: true, &block)
raise "Referential not created" if new_record?
unless block_given?
Rails.logger.debug "Referential switch to #{slug}" if verbose
- 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 range_to_string
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.range_to_string(object)
from = object.begin.respond_to?(:infinite?) && object.begin.infinite? ? '' : object.begin
to = object.end.respond_to?(:infinite?) && object.end.infinite? ? '' : object.end
"[#{from},#{to}#{object.exclude_end? ? ')' : ']'}"
end
- 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 overlapped_referential_ids
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def overlapped_referential_ids
return [] unless metadatas.present?
line_ids = metadatas.first.line_ids
periodes = metadatas.first.periodes
- 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"