Class BuildInDataType
has 54 methods (exceeds 20 allowed). Consider refactoring. Open
class BuildInDataType
include SchemaHandler
include DataTypeParser
attr_reader :model
Method build_schema
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def build_schema
@discarding ||= []
schema = Mongoff::Model.base_schema.deep_merge('properties' => { 'id' => {} })
properties = schema['properties']
if model < ClassHierarchyAware
- 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
File build_in_data_type.rb
has 364 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'edi/formater'
require 'xsd/core_ext'
module Setup
class BuildInDataType
Method build_schema
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_schema
@discarding ||= []
schema = Mongoff::Model.base_schema.deep_merge('properties' => { 'id' => {} })
properties = schema['properties']
if model < ClassHierarchyAware
Method store_fields
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def store_fields(instance_variable, *fields)
if fields
fail 'Illegal argument' unless fields.present?
fields = [fields] unless fields.is_a?(Enumerable)
instance_variable_set(instance_variable, fields.flatten.collect(&:to_s).uniq.select(&:present?))
- 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 all_data_type_storage_collections_names
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def all_data_type_storage_collections_names
if model < CrossOrigin::CenitDocument
origins = model.origins.select { |origin| Setup::Crossing.authorized_crossing_origins.include?(origin) }
origins.collect do |origin|
if origin == :default
- 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"