Showing 829 of 829 total issues
Method pull_request
has 135 lines of code (exceeds 25 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|
Class Record
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
class Record
include Savable
include Destroyable
include Edi::Filler
include Edi::Formatter
Method run
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def run(message)
data_type = data_type_from(message)
if data_type
if data_type.bulkable_deletable?
if (model = data_type.records_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 check_schema
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def check_schema(json, name, defined_types, embedded_refs, root_schema)
if (refs = json['$ref'])
refs = [refs] unless refs.is_a?(Array)
refs.each { |ref| embedded_refs[ref] = check_embedded_ref(ref, root_schema) if ref.is_a?(String) && ref.start_with?('#') }
elsif json['type'].nil? || json['type'].eql?('object')
- 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_type
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def check_type(types, instance, _, _, options, schema)
return if instance.nil? && options[:skip_nulls]
if types
types = [types] unless types.is_a?(Array)
types = types.map(&:to_s).map(&:to_sym)
- 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_dependentRequired
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def check_dependentRequired(properties, instance)
return unless instance
if instance.is_a?(Mongoff::Record)
has_errors = false
stored_properties = instance.orm_model.stored_properties_on(instance).map(&:to_s)
- 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_additionalProperties
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def check_additionalProperties(schema, 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 check_properties
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def check_properties(properties, 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 new_user
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def new_user
data = (JSON.parse(request_data) rescue {}).keep_if { |key, _| USER_API_FIELDS.include?(key) }
data = data.with_indifferent_access
data.reverse_merge!(email: params[:email], password: pwd = params[:password])
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 to_json_schema
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def to_json_schema
json_schema = documenting('type' => 'object')
if name
json_schema['title'] = name.to_title
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
File cross_shared_collection.rb
has 373 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Setup
class CrossSharedCollection
include CenitUnscoped
include CrossOrigin::CenitDocument
include CollectionBehavior
Method index
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def index
skip_consent = false
if request.get?
if @errors.blank?
if @app_id && (@app_id.tenant == Account.current || @app_id.registered?)
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
window.App = (function () {
const resizeListeners = [];
const resize = document.body.onresize = function () {
resizeListeners.forEach(listener => {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 133.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
window.App = (function () {
const resizeListeners = [];
const resize = document.body.onresize = function () {
resizeListeners.forEach(listener => {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 133.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method to_map_schema
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def to_map_schema(sch)
if sch['type'] == 'object' && (properties = sch['properties']).is_a?(Hash)
new_properties = {}
id_optional = true
properties.each do |property, property_schema|
- 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 32 (exceeds 5 allowed). Consider refactoring. Open
def index
setup_viewport
items = select_items
if (distinct = params[:format]&.match(/\Adistinct\((.+)\)\Z/))
json = klass.collection.distinct(distinct[1], items.selector)
- 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 simple_translate
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def simple_translate(message, &block)
unless (options = message[:options]).is_a?(Hash)
options = {}
end
task = message[:task]
- 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 token
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def token
response = {}
response_code = :bad_request
errors = ''
token_class =
- 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 property_for
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def property_for(name)
@properties_by_name ||= {}
unless @properties_by_name.key?(name)
segment_property = nil
name_property = 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"