Showing 739 of 829 total issues
Method do_parse_json
has a Cognitive Complexity of 341 (exceeds 5 allowed). Consider refactoring. Open
def do_parse_json(data_type, model, json, options, json_schema, record = nil, new_record = nil, container = nil, container_schema = nil)
add_new = options.delete(:add_new)
updating = !(record.nil? && new_record.nil?) || options[:add_only]
(primary_fields = options.delete(:primary_field) || options.delete('primary_field')).present? ||
(primary_fields = json.is_a?(Hash) && json['_primary']).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
File api_controller.rb
has 1591 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Api::V3
class ApiController < ApplicationController
include OAuth2AccountAuthorization
include CorsCheck
Method do_parse_xml
has a Cognitive Complexity of 191 (exceeds 5 allowed). Consider refactoring. Open
def do_parse_xml(data_type, model, element, options, json_schema, record = nil, new_record = nil, enclosed_property = nil, container = nil, container_schema = nil)
updating = !(record.nil? && new_record.nil?) || options[:add_only]
json_schema = data_type.merge_schema(json_schema)
name = json_schema['edi']['segment'] if json_schema['edi']
name ||= enclosed_property || model.data_type.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 do_parse_edi
has a Cognitive Complexity of 177 (exceeds 5 allowed). Consider refactoring. Open
def do_parse_edi(data_type, model, content, json_schema, start, field_sep, segment_sep, report, options = {})
record = options[:record] || options[:new_record] || model.new
json = options[:json]
fields = options[:fields]
segment = options[:segment]
- 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 validator.rb
has 1158 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'resolv'
module Mongoff
module Validator
extend self
Method record_to_hash
has a Cognitive Complexity of 144 (exceeds 5 allowed). Consider refactoring. Open
def record_to_hash(record, options, referenced, enclosed_model, max_entries, viewport)
return record if Cenit::Utility.json_object?(record)
model =
begin
record.orm_model
- 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 do_merge_schema
has a Cognitive Complexity of 139 (exceeds 5 allowed). Consider refactoring. Open
def do_merge_schema(schema, options = {})
if schema.is_a?(Array)
return schema.collect { |sch| do_merge_schema(sch, options) }
end
return schema unless schema.is_a?(Hash)
- 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 pull_request
has a Cognitive Complexity of 108 (exceeds 5 allowed). Consider refactoring. Open
def pull_request(shared_collection, options = {})
pull_parameters = options[:pull_parameters] || {}
missing_parameters = []
unless options[:ignore_missing_parameters]
shared_collection.each_pull_parameter do |pull_parameter|
- 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 record_to_xml_element
has a Cognitive Complexity of 104 (exceeds 5 allowed). Consider refactoring. Open
def record_to_xml_element(data_type, schema, record, xml_doc, enclosed_property_name, options, namespaces)
return unless record
if Cenit::Utility.json_object?(record)
return Nokogiri::XML({ enclosed_property_name => record }.to_xml(dasherize: false)).root.first_element_child
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 save_references
has a Cognitive Complexity of 103 (exceeds 5 allowed). Consider refactoring. Open
def save_references(record, options, saved, visited = Set.new)
# TODO: Propagate error to parent relation...
return true if visited.include?(record)
visited << record
if record.is_a?(Setup::Collection)
- 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 bind_references
has a Cognitive Complexity of 103 (exceeds 5 allowed). Consider refactoring. Open
def bind_references(record, options = {})
options ||= {}
references = {}
for_each_node_starting_at(record, options) do |obj|
::Setup::Optimizer.instance.regist_data_types(obj)
- 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_message
has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring. Open
def process_message(message, options = {})
unless message.is_a?(Hash)
message =
begin
JSON.parse(message)
- 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 validates_mapping
has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring. Open
def validates_mapping
mapping.validate
unless mapping.errors.present?
map_model.for_each_association do |a|
name = a[: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 validates_mapping
has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring. Open
def validates_mapping
mapping.validate
unless mapping.errors.present?
map_model.for_each_association do |a|
name = a[: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
File api_controller.rb
has 723 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Api::V2
class ApiController < ApplicationController
before_action :authorize_account, except: [:new_user, :cors_check, :auth]
before_action :save_request_data, except: [:cors_check, :auth]
Method validates_configuration
has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring. Open
def validates_configuration
format_triggers_on(:scope_filter) if scope_filter.present?
unless requires(:name, :translator)
if event.present?
unless translator.type == :Import || requires(:data_type_scope)
- 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 validate_instance
has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring. Open
def validate_instance(instance, options = {})
unless (visited = options[:visited])
visited = options[:visited] = Set.new
end
unless (soft_checked = visited.include?(instance))
- 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 formater.rb
has 623 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Edi
module Formatter
def self_record
self
end
Method add_dependencies
has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring. Open
def add_dependencies
return true unless @add_dependencies
self.warnings = []
collecting_models = {}
COLLECTING_PROPERTIES.each do |property|
- 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 prepare
has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring. Open
def self.prepare
return self if @init_done
@init_done = true
actions = Setup::Models.all.reduce(Set.new) do |set, model|
- 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"