Showing 1,291 of 1,823 total issues
Method run
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def run
loop do
if @stopping
@nio.close
break
- 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 CollectionAssociation
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class CollectionAssociation < Association # :nodoc:
# Implements the reader method, e.g. foo.items for Foo.has_many :items
def reader
ensure_klass_exists!
Class CollectionProxy
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class CollectionProxy < Relation
def initialize(klass, association, **) # :nodoc:
@association = association
super klass
Method assign_nested_attributes_for_collection_association
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def assign_nested_attributes_for_collection_association(association_name, attributes_collection)
options = nested_attributes_options[association_name]
if attributes_collection.respond_to?(:permitted?)
attributes_collection = attributes_collection.to_h
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 calculate
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def calculate(operation, column_name)
operation = operation.to_s.downcase
if @none
case operation
- 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 batch_on_unloaded_relation
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def batch_on_unloaded_relation(relation:, start:, finish:, load:, order:, use_ranges:, remaining:, batch_limit:)
batch_orders = build_batch_orders(order)
relation = relation.reorder(batch_orders.to_h).limit(batch_limit)
relation = apply_limits(relation, start, finish, batch_orders)
relation.skip_query_cache! # Retaining the results in the query cache would undermine the point of batching
- 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 listen
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def listen(conn)
conn.without_reconnect do
original_client = extract_subscribed_client(conn)
conn.subscribe("_action_cable_internal") do |on|
- 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 render_details
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def render_details(req)
threads = ActiveSupport::Dependencies.interlock.raw_state do |raw_threads|
# The Interlock itself comes to a complete halt as long as this block is
# executing. That gives us a more consistent picture of everything, but creates
# a pretty strong Observer Effect.
- 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 tag_options
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def tag_options(options, escape = true)
return if options.blank?
output = +""
sep = " "
options.each_pair do |key, value|
- 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 TimeZone
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
class TimeZone
# Keys are \Rails TimeZone names, values are TZInfo identifiers.
MAPPING = {
"International Date Line West" => "Etc/GMT+12",
"Midway Island" => "Pacific/Midway",
File collection_association.rb
has 359 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "active_support/core_ext/enumerable"
module ActiveRecord
module Associations
# = Active Record Association Collection
Method find_by
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def find_by(*args) # :nodoc:
return super if scope_attributes?
hash = args.first
return super unless Hash === 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 resolve_sti_reflections
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def resolve_sti_reflections
# If STI is used, find the correct subclass for association reflection
reflection_class._reflections.each_value do |association|
case association.macro
when :belongs_to
- 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 visit_Arel_Nodes_BoundSqlLiteral
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def visit_Arel_Nodes_BoundSqlLiteral(o, collector)
collector.retryable = false
bind_index = 0
new_bind = lambda do |value|
- 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 move
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def move(t, full_string, start_index, end_index)
return [] if t.empty?
next_states = []
- 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 tag_helper.rb
has 357 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "active_support/code_generator"
require "active_support/core_ext/enumerable"
require "active_support/core_ext/string/output_safety"
require "active_support/core_ext/string/inflections"
require "set"
File active_record.rb
has 352 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "active_support"
require "active_support/rails"
require "active_support/ordered_options"
require "active_model"
require "arel"
Method run_callbacks
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def run_callbacks(kind, type = nil)
callbacks = __callbacks[kind.to_sym]
if callbacks.empty?
yield if block_given?
- 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 find_offset
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def find_offset(compiled, source_tokens, error_column)
compiled = StringScanner.new(compiled)
passed_tokens = []
- 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 render_calls
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def render_calls
queue = [Prism.parse(@code).value]
templates = []
while (node = queue.shift)
- 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"