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"
Severity: Major
Found in railties/lib/rails/application.rb - About 7 hrs to fix

    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:
      Severity: Minor
      Found in activerecord/lib/active_record/tasks/database_tasks.rb - About 7 hrs to fix

        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"
        Severity: Minor
        Found in railties/lib/rails/application/configuration.rb - About 7 hrs to fix

          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");
          Severity: Major
          Found in actiontext/app/assets/javascripts/trix.js - About 7 hrs to fix

            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
            Severity: Minor
            Found in railties/lib/rails/application/default_middleware_stack.rb - About 7 hrs to fix

            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");
            Severity: Major
            Found in actiontext/app/assets/javascripts/trix.js - About 7 hrs to fix

              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)
              Severity: Minor
              Found in activerecord/lib/active_record/relation/predicate_builder.rb - About 7 hrs to fix

              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"
              
              
              Severity: Minor
              Found in activerecord/lib/active_record/core.rb - About 7 hrs to fix

                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"
                Severity: Minor
                Found in actionview/lib/action_view/helpers/date_helper.rb - About 7 hrs to fix

                  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,
                  Severity: Minor
                  Found in activerecord/lib/active_record/autosave_association.rb - About 6 hrs to fix

                  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"
                  Severity: Minor
                  Found in actionpack/lib/action_dispatch/middleware/cookies.rb - About 6 hrs to fix

                    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
                    Severity: Minor
                    Found in actionpack/lib/action_dispatch/http/response.rb - About 6 hrs to fix

                      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"
                      Severity: Minor
                      Found in actionview/lib/action_view/helpers/form_helper.rb - About 6 hrs to fix

                        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(() => {
                        Severity: Major
                        Found in actiontext/app/assets/javascripts/trix.js - About 6 hrs to fix

                          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
                          Severity: Minor
                          Found in activesupport/lib/active_support/cache.rb - About 6 hrs to fix

                            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
                            Severity: Minor
                            Found in activesupport/lib/active_support/hash_with_indifferent_access.rb - About 5 hrs to fix

                              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
                              Severity: Minor
                              Found in activestorage/app/models/active_storage/blob.rb - About 5 hrs to fix

                                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
                                Severity: Minor
                                Found in activerecord/lib/active_record/reflection.rb - About 5 hrs to fix

                                  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
                                  Severity: Minor
                                  Found in activerecord/lib/active_record/associations/association.rb - About 5 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language