Showing 1,298 of 1,828 total issues

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

    File calculations.rb has 400 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "active_support/core_ext/enumerable"
    
    module ActiveRecord
      # = Active Record \Calculations
      module Calculations
    Severity: Minor
    Found in activerecord/lib/active_record/relation/calculations.rb - About 5 hrs to fix

      File plugin_generator.rb has 399 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require "active_support/core_ext/hash/except"
      require "rails/generators/rails/app/app_generator"
      require "date"
      
      module Rails
      Severity: Minor
      Found in railties/lib/rails/generators/rails/plugin/plugin_generator.rb - About 5 hrs to fix

        Class Dot has 41 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class Dot < Arel::Visitors::Visitor
              class Node # :nodoc:
                attr_accessor :name, :id, :fields
        
                def initialize(name, id, fields = [])
        Severity: Minor
        Found in activerecord/lib/arel/visitors/dot.rb - About 5 hrs to fix

          Class ExceptionWrapper has 40 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class ExceptionWrapper
              cattr_accessor :rescue_responses, default: Hash.new(:internal_server_error).merge!(
                "ActionController::RoutingError"                     => :not_found,
                "AbstractController::ActionNotFound"                 => :not_found,
                "ActionController::MethodNotAllowed"                 => :method_not_allowed,
          Severity: Minor
          Found in actionpack/lib/action_dispatch/middleware/exception_wrapper.rb - About 5 hrs to fix

            Function md5cycle has 133 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function md5cycle(x, k) {
                  var a = x[0], b = x[1], c = x[2], d = x[3];
                  a += (b & c | ~b & d) + k[0] - 680876936 | 0;
                  a = (a << 7 | a >>> 25) + b | 0;
                  d += (a & b | ~a & c) + k[1] - 389564586 | 0;
            Severity: Major
            Found in actiontext/app/assets/javascripts/actiontext.esm.js - About 5 hrs to fix

              Function md5cycle has 133 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    function md5cycle(x, k) {
                      var a = x[0], b = x[1], c = x[2], d = x[3];
                      a += (b & c | ~b & d) + k[0] - 680876936 | 0;
                      a = (a << 7 | a >>> 25) + b | 0;
                      d += (a & b | ~a & c) + k[1] - 389564586 | 0;
              Severity: Major
              Found in actiontext/app/assets/javascripts/actiontext.js - About 5 hrs to fix

                Function md5cycle has 133 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      function md5cycle(x, k) {
                        var a = x[0], b = x[1], c = x[2], d = x[3];
                        a += (b & c | ~b & d) + k[0] - 680876936 | 0;
                        a = (a << 7 | a >>> 25) + b | 0;
                        d += (a & b | ~a & c) + k[1] - 389564586 | 0;
                Severity: Major
                Found in activestorage/app/assets/javascripts/activestorage.js - About 5 hrs to fix

                  Function md5cycle has 133 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function md5cycle(x, k) {
                        var a = x[0], b = x[1], c = x[2], d = x[3];
                        a += (b & c | ~b & d) + k[0] - 680876936 | 0;
                        a = (a << 7 | a >>> 25) + b | 0;
                        d += (a & b | ~a & c) + k[1] - 389564586 | 0;
                  Severity: Major
                  Found in activestorage/app/assets/javascripts/activestorage.esm.js - About 5 hrs to fix

                    File compatibility.rb has 387 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    module ActiveRecord
                      class Migration
                        module Compatibility # :nodoc: all
                          def self.find(version)
                            version = version.to_s
                    Severity: Minor
                    Found in activerecord/lib/active_record/migration/compatibility.rb - About 5 hrs to fix

                      File database_statements.rb has 386 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      module ActiveRecord
                        module ConnectionAdapters # :nodoc:
                          module DatabaseStatements
                            def initialize
                              super

                        File time_zone.rb has 384 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require "tzinfo"
                        require "concurrent/map"
                        
                        module ActiveSupport
                          # = Active Support \Time Zone
                        Severity: Minor
                        Found in activesupport/lib/active_support/values/time_zone.rb - About 5 hrs to fix

                          File test_case.rb has 380 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          require "rack/session/abstract/id"
                          require "active_support/core_ext/hash/conversions"
                          require "active_support/core_ext/object/to_query"
                          require "active_support/core_ext/module/anonymous"
                          require "active_support/core_ext/module/redefine_method"
                          Severity: Minor
                          Found in actionpack/lib/action_controller/test_case.rb - About 5 hrs to fix

                            Method fetch has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                            Open

                                  def fetch(name, options = nil, &block)
                                    if block_given?
                                      options = merged_options(options)
                                      key = normalize_key(name, options)
                            
                            
                            Severity: Minor
                            Found in activesupport/lib/active_support/cache.rb - About 5 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

                            Method store_accessor has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                            Open

                                  def store_accessor(store_attribute, *keys, prefix: nil, suffix: nil)
                                    keys = keys.flatten
                            
                                    accessor_prefix =
                                      case prefix
                            Severity: Minor
                            Found in activerecord/lib/active_record/store.rb - About 5 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

                            Method execute_grouped_calculation has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                            Open

                                  def execute_grouped_calculation(operation, column_name, distinct) # :nodoc:
                                    group_fields = group_values
                                    group_fields = group_fields.uniq if group_fields.size > 1
                            
                                    if group_fields.size == 1 && group_fields.first.respond_to?(:to_sym)
                            Severity: Minor
                            Found in activerecord/lib/active_record/relation/calculations.rb - About 5 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 schema_cache.rb has 378 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            require "active_support/core_ext/file/atomic"
                            
                            module ActiveRecord
                              module ConnectionAdapters
                                class SchemaReflection
                            Severity: Minor
                            Found in activerecord/lib/active_record/connection_adapters/schema_cache.rb - About 5 hrs to fix

                              Class SelectManager has 38 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                                class SelectManager < Arel::TreeManager
                                  include Arel::Crud
                              
                                  STRING_OR_SYMBOL_CLASS = [Symbol, String]
                              
                              
                              Severity: Minor
                              Found in activerecord/lib/arel/select_manager.rb - About 5 hrs to fix

                                Method deserialize has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                                Open

                                          def deserialize(value)
                                            return value unless value.is_a?(::String)
                                
                                            scanner = StringScanner.new(value)
                                            hash = {}

                                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 with_raw_connection has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                                Open

                                        def with_raw_connection(allow_retry: false, materialize_transactions: true)
                                          @lock.synchronize do
                                            connect! if @raw_connection.nil? && reconnect_can_restore_state?
                                
                                            self.materialize_transactions if materialize_transactions

                                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

                                Severity
                                Category
                                Status
                                Source
                                Language