Showing 739 of 829 total issues
File utility.rb
has 461 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'objspace'
module Cenit
class Utility
File converter.rb
has 456 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Setup
class Converter < LegacyTranslator
include Setup::TranslationCommon::ClassMethods
Method do_map
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def do_map(source)
plain_properties = []
map_model.properties_schemas.each do |property, schema|
plain_properties << property unless schema[MappingModel::SCHEMA_FLAG]
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 do_map
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def do_map(source)
plain_properties = []
map_model.properties_schemas.each do |property, schema|
plain_properties << property unless schema[MappingModel::SCHEMA_FLAG]
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 for_each_node_starting_at
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def for_each_node_starting_at(record, options = {}, &block)
stack = options[:stack]
unless (visited = options[:visited])
visited = options[:visited] = Set.new
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
Class Task
has 49 methods (exceeds 20 allowed). Consider refactoring. Open
class Task
include CenitScoped
include ClassHierarchyAware
include CrossOrigin::CenitDocument
include FieldsInspection
Method check_patternProperties
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def check_patternProperties(patterns, instance, state, data_type, options)
path = options[:path] || '#'
unless (checked_properties = state[:checked_properties])
checked_properties = state[:checked_properties] = Set.new
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 eql_content?
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def eql_content?(a, b, key = nil, &block)
case a
when Hash
if b.is_a?(Hash)
if a.size < b.size
- 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 446 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Api::V1
class ApiController < ApplicationController
before_action :authorize_account, :save_request_data, except: [:new_user, :cors_check, :auth]
before_action :find_item, only: [:show, :destroy, :pull, :run]
before_action :authorize_action, except: [:auth, :new_user, :cors_check, :push]
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
Method process_on
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def process_on(hash_data, options = {})
options ||= {}
errors.clear
properties_locations.each do |property_location|
property_location.errors.clear
- 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 translate_export
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def translate_export(message, &block)
limit = translator.try(:bulk_source) ? lot_size || 1000 : 1
source_scope = sources(message)
max = source_scope.count - 1
translation_options = nil
- 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
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def save(record, options = {})
saved = options[:saved_collector] || Set.new
if bind_references(record, options.delete(:bind_references))
success =
if record.try(:save_self_before_refs)
- 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 source_options
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def source_options(options, source_key_options = self.source_key_options)
data_type_key = source_key_options[:data_type_key] || :source_data_type
if (data_type = send(data_type_key) || options[data_type_key] || options[:data_type])
model = data_type.records_model
offset = options[:offset] || 0
- 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 authorize_account
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def authorize_account
user = nil
if (auth_header = request.headers['Authorization'])
auth_header = auth_header.to_s.squeeze(' ').strip.split(' ')
if auth_header.length == 2
- 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 pretty_errors
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def pretty_errors(record, stack = Set.new)
return {} unless record
stack << record
errors = record.errors.messages.dup.with_indifferent_access
if errors.key?(:base) && !property?(:base)
- 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
Class Control
has 46 methods (exceeds 20 allowed). Consider refactoring. Open
class Control
include CanCan::Ability
attr_reader :app, :action, :controller
attr_accessor :view
Method check_embedded_items
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def check_embedded_items(item, record)
(item_model = record.class).model_properties_schemas.each do |property, schema|
next if schema['referenced']
next unless (property_value = item[property]) && (property_model = item_model.property_model(property))
next unless (property_data_type = property_model.data_type).get_referenced_by.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 check_index
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def check_index
if request.get?
@errors << 'Missing client_id.' unless (@client_id = params[:client_id])
if (@response_type = params[:response_type])
@errors << 'Invalid response_type.' unless @response_type == '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 hash_decode
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def hash_decode(value)
case value
when Hash
r = nil
if value.size == 1
- 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"