app/models/setup/data_type_generation.rb
Method run
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
Open
def run(message)
message = message.with_indifferent_access
json_schemas = Setup::DataTypeGeneration.data_type_schemas(message[:source], { data_type_names: data_type_names = {} })
json_schemas.each do |ns, data_type_schemas|
existing_data_types = Setup::DataType.any_in(namespace: ns, name: data_type_schemas.keys)
- 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 data_type_schemas
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def data_type_schemas(source, options = {})
options[:schemas] = schemas =
case source
when nil # All schemas
Setup::Schema.all
Method run
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def run(message)
message = message.with_indifferent_access
json_schemas = Setup::DataTypeGeneration.data_type_schemas(message[:source], { data_type_names: data_type_names = {} })
json_schemas.each do |ns, data_type_schemas|
existing_data_types = Setup::DataType.any_in(namespace: ns, name: data_type_schemas.keys)
Method data_type_schemas
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def data_type_schemas(source, options = {})
options[:schemas] = schemas =
case source
when nil # All schemas
Setup::Schema.all
- 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"