Showing 1,291 of 1,823 total issues
Class Application
has 53 methods (exceeds 20 allowed). Consider refactoring. Open
class Application < Engine
autoload :Bootstrap, "rails/application/bootstrap"
autoload :Configuration, "rails/application/configuration"
autoload :DefaultMiddlewareStack, "rails/application/default_middleware_stack"
autoload :Finisher, "rails/application/finisher"
File transaction.rb
has 478 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveRecord
module ConnectionAdapters
# = Active Record Connection Adapters Transaction State
class TransactionState
def initialize(state = nil)
File database_tasks.rb
has 475 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "active_record/database_configurations"
module ActiveRecord
module Tasks # :nodoc:
class DatabaseNotSupported < StandardError; end # :nodoc:
File configuration.rb
has 474 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "ipaddr"
require "active_support/core_ext/array/wrap"
require "active_support/core_ext/kernel/reporting"
require "active_support/file_update_checker"
require "active_support/configuration_file"
Function applyDecs2203RFactory
has 184 lines of code (exceeds 25 allowed). Consider refactoring. Open
function applyDecs2203RFactory() {
function createAddInitializerMethod(e, t) {
return function (r) {
!function (e, t) {
if (e.v) throw new Error("attempted to call " + t + " after decoration was finished");
Method build_stack
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
def build_stack
ActionDispatch::MiddlewareStack.new do |middleware|
unless Array(config.hosts).empty?
middleware.use ::ActionDispatch::HostAuthorization, config.hosts, **config.host_authorization
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
Function applyDecs2203Factory
has 179 lines of code (exceeds 25 allowed). Consider refactoring. Open
function applyDecs2203Factory() {
function createAddInitializerMethod(e, t) {
return function (r) {
!function (e, t) {
if (e.v) throw new Error("attempted to call " + t + " after decoration was finished");
Method expand_from_hash
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
def expand_from_hash(attributes, &block)
return ["1=0"] if attributes.empty?
attributes.flat_map do |key, value|
if key.is_a?(Array)
- 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.rb
has 460 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "active_support/core_ext/enumerable"
require "active_support/core_ext/module/delegation"
require "active_support/parameter_filter"
require "concurrent/map"
File date_helper.rb
has 459 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "date"
require "action_view/helpers/tag_helper"
require "active_support/core_ext/array/extract_options"
require "active_support/core_ext/date/conversions"
require "active_support/core_ext/hash/slice"
Method save_collection_association
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def save_collection_association(reflection)
if association = association_instance_get(reflection.name)
autosave = reflection.options[:autosave]
# By saving the instance variable in a local variable,
- 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 cookies.rb
has 436 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "active_support/core_ext/hash/keys"
require "active_support/key_generator"
require "active_support/message_verifier"
require "active_support/json"
require "rack/utils"
Class Response
has 46 methods (exceeds 20 allowed). Consider refactoring. Open
class Response
begin
# For `Rack::Headers` (Rack 3+):
require "rack/headers"
Headers = ::Rack::Headers
File form_helper.rb
has 424 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "cgi"
require "action_view/helpers/date_helper"
require "action_view/helpers/url_helper"
require "action_view/helpers/form_tag_helper"
require "action_view/helpers/active_model_helper"
Function constructor
has 154 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(attachmentPiece, _element, container) {
let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
super(...arguments);
// Installing and uninstalling
_defineProperty(this, "makeElementMutable", undoable(() => {
Class Store
has 44 methods (exceeds 20 allowed). Consider refactoring. Open
class Store
cattr_accessor :logger, instance_writer: true
cattr_accessor :raise_on_invalid_cache_expiration_time, default: false
attr_reader :silence, :options
Class HashWithIndifferentAccess
has 43 methods (exceeds 20 allowed). Consider refactoring. Open
class HashWithIndifferentAccess < Hash
# Returns +true+ so that <tt>Array#extract_options!</tt> finds members of
# this class.
def extractable_options?
true
Class Blob
has 43 methods (exceeds 20 allowed). Consider refactoring. Open
class ActiveStorage::Blob < ActiveStorage::Record
MINIMUM_TOKEN_LENGTH = 28
has_secure_token :key, length: MINIMUM_TOKEN_LENGTH
store :metadata, accessors: [ :analyzed, :identified, :composed ], coder: ActiveRecord::Coders::JSON
Class AssociationReflection
has 43 methods (exceeds 20 allowed). Consider refactoring. Open
class AssociationReflection < MacroReflection # :nodoc:
def compute_class(name)
if polymorphic?
raise ArgumentError, "Polymorphic associations do not support computing the class."
end
Class Association
has 43 methods (exceeds 20 allowed). Consider refactoring. Open
class Association # :nodoc:
attr_accessor :owner
attr_reader :target, :reflection, :disable_joins
delegate :options, to: :reflection