Showing 829 of 829 total issues
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"
Further reading
File task.rb
has 423 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Setup
class Task
include CenitScoped
include ClassHierarchyAware
include CrossOrigin::CenitDocument
Method authorize_account
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def authorize_account
@authentication_method = nil
user = nil
# New key and token params.
- 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_hash
has 152 lines of code (exceeds 25 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
Method execute
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def execute(options = {})
task_desc = description.presence || "Task ##{id}"
if running? || !Cenit::Locker.lock(self)
notify(message: "Executing task ##{id} at #{Time.now} but it is already running")
else
- 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 new
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def new
response = {}
%w(success warnings errors).each { |key| response[key.to_sym] = Hash.new { |h, k| h[k] = [] } }
@payload.each do |root, message|
if (data_type = @payload.data_type_for(root))
- 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 core_ext.rb
has 411 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Module
class << self
def demongoize(object)
object.to_s.constantize
Method each_entry
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def each_entry(&block)
state.clear if state[:done]
if decompress_content?
begin
Zip::InputStream.open(StringIO.new(data.read)) do |zis|
- 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 38 (exceeds 5 allowed). Consider refactoring. Open
def source_options(options, 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 process_http_connection
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def process_http_connection(connection, template_parameters, verbose_response, last_response, options, &block)
template_parameters[:method] ||= method
conformed_url = template_parameters[:url]
conformed_path = template_parameters[:path]
parameters = connection.conformed_parameters(template_parameters)
- 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 index
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def index
if klass
@items =
if @criteria.present?
if (sort_key = @criteria.delete(:sort_by))
- 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 143 lines of code (exceeds 25 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]
Method new_user
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def new_user
data = (JSON.parse(@webhook_body) rescue {}).keep_if { |key, _| USER_API_FIELDS.include?(key) }
data = data.with_indifferent_access
data.reverse_merge!(email: params[:email], password: pwd = params[:password], password_confirmation: params[:password_confirmation] || pwd)
data.reject! { |_, value| value.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 callback
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def callback
redirect_uri = nil
error = params[:error]
if (cenit_token = CallbackAuthorizationToken.where(token: params[:state] || session[:oauth_state]).first) &&
(User.current = cenit_token.set_current_tenant!.owner) && (auth = cenit_token.authorization)
- 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 record.rb
has 396 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Mongoff
class Record
include Savable
include Destroyable
include Edi::Filler
Class Account
has 41 methods (exceeds 20 allowed). Consider refactoring. Open
class Account
include Setup::CenitUnscoped
include Cenit::MultiTenancy
include CredentialsGenerator
include FieldsInspection
Method do_parse_xml
has 136 lines of code (exceeds 25 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
Method new
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def new
if (provider = params[:with])
redirect_to "/app/#{::Cenit::OpenId.app_key}?with=#{provider}&redirect_uri=#{Cenit.homepage}#{session_path(resource_name)}"
elsif (code = params[:code])
if (user = ::Cenit::OpenId.get_user_by(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 process_http_connection
has 135 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_http_connection(connection, template_parameters, verbose_response, last_response, options, &block)
template_parameters[:method] ||= method
conformed_url = template_parameters[:url]
conformed_path = template_parameters[:path]
parameters = connection.conformed_parameters(template_parameters)