Showing 1,298 of 1,828 total issues

Class Session has 31 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Session # :nodoc:
      DisabledSessionError    = Class.new(StandardError)
      ENV_SESSION_KEY         = Rack::RACK_SESSION # :nodoc:
      ENV_SESSION_OPTIONS_KEY = Rack::RACK_SESSION_OPTIONS # :nodoc:

Severity: Minor
Found in actionpack/lib/action_dispatch/request/session.rb - About 3 hrs to fix

    Class DateTimeSelector has 31 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class DateTimeSelector # :nodoc:
          include ActionView::Helpers::TagHelper
    
          DEFAULT_PREFIX = "date"
          POSITION = {
    Severity: Minor
    Found in actionview/lib/action_view/helpers/date_helper.rb - About 3 hrs to fix

      Class Base has 31 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class Base < Thor::Group
            include Thor::Actions
            include Rails::Generators::Actions
      
            class_option :skip_namespace, type: :boolean, default: false,
      Severity: Minor
      Found in railties/lib/rails/generators/base.rb - About 3 hrs to fix

        Class GeneratedAttribute has 31 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class GeneratedAttribute # :nodoc:
              INDEX_OPTIONS = %w(index uniq)
              UNIQ_INDEX_OPTIONS = %w(uniq)
              DEFAULT_TYPES = %w(
                attachment
        Severity: Minor
        Found in railties/lib/rails/generators/generated_attribute.rb - About 3 hrs to fix

          Method build_join_buckets has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

                def build_join_buckets
                  buckets = Hash.new { |h, k| h[k] = [] }
          
                  unless left_outer_joins_values.empty?
                    stashed_left_joins = []
          Severity: Minor
          Found in activerecord/lib/active_record/relation/query_methods.rb - About 3 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 save_has_one_association has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

                def save_has_one_association(reflection)
                  association = association_instance_get(reflection.name)
                  record      = association && association.load_target
          
                  if record && !record.destroyed?
          Severity: Minor
          Found in activerecord/lib/active_record/autosave_association.rb - About 3 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 table has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

                def table(table, stream)
                  columns = @connection.columns(table)
                  begin
                    self.table_name = table
          
          
          Severity: Minor
          Found in activerecord/lib/active_record/schema_dumper.rb - About 3 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 translate has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

                def translate(key, **options)
                  return key.map { |k| translate(k, **options) } if key.is_a?(Array)
                  key = key&.to_s unless key.is_a?(Symbol)
          
                  alternatives = if options.key?(:default)
          Severity: Minor
          Found in actionview/lib/action_view/helpers/translation_helper.rb - About 3 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

          Class Attribute has 30 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class Attribute # :nodoc:
              class << self
                def from_database(name, value_before_type_cast, type, value = nil)
                  FromDatabase.new(name, value_before_type_cast, type, nil, value)
                end
          Severity: Minor
          Found in activemodel/lib/active_model/attribute.rb - About 3 hrs to fix

            Class RedisCacheStore has 30 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class RedisCacheStore < Store
                  # Keys are truncated with the Active Support digest if they exceed 1kB
                  MAX_KEY_BYTESIZE = 1024
            
                  DEFAULT_REDIS_OPTIONS = {
            Severity: Minor
            Found in activesupport/lib/active_support/cache/redis_cache_store.rb - About 3 hrs to fix

              Class Base has 30 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class Base
                    include Identification
                    include InternalChannel
                    include Authorization
                    include Callbacks
              Severity: Minor
              Found in actioncable/lib/action_cable/connection/base.rb - About 3 hrs to fix

                Method tokenize has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                Open

                    def self.tokenize(source) # :nodoc:
                      require "strscan"
                      source = StringScanner.new(source.chomp)
                      tokens = []
                
                
                Severity: Minor
                Found in activesupport/lib/active_support/core_ext/erb/util.rb - About 3 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 parse! has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                Open

                      def parse!
                        while !finished?
                          case mode
                          when :start
                            if scan(SIGN_MARKER)
                Severity: Minor
                Found in activesupport/lib/active_support/duration/iso8601_parser.rb - About 3 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 engine.rb has 313 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require "rails/railtie"
                require "rails/engine/railties"
                require "active_support/callbacks"
                require "active_support/core_ext/module/delegation"
                require "active_support/core_ext/object/try"
                Severity: Minor
                Found in railties/lib/rails/engine.rb - About 3 hrs to fix

                  Method save_belongs_to_association has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def save_belongs_to_association(reflection)
                          association = association_instance_get(reflection.name)
                          return unless association && association.loaded? && !association.stale_target?
                  
                          record = association.load_target
                  Severity: Minor
                  Found in activerecord/lib/active_record/autosave_association.rb - About 3 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 generate has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def generate(name, options, path_parameters)
                          original_options = options.dup
                          path_params = options.delete(:path_params) || {}
                          options = path_params.merge(options)
                          constraints = path_parameters.merge(options)
                  Severity: Minor
                  Found in actionpack/lib/action_dispatch/journey/formatter.rb - About 3 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 select_datetime has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def select_datetime
                          order = date_order.dup
                          order -= [:hour, :minute, :second]
                          @options[:discard_year]   ||= true unless order.include?(:year)
                          @options[:discard_month]  ||= true unless order.include?(:month)
                  Severity: Minor
                  Found in actionview/lib/action_view/helpers/date_helper.rb - About 3 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 stylesheet_link_tag has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def stylesheet_link_tag(*sources)
                          options = sources.extract_options!.stringify_keys
                          path_options = options.extract!("protocol", "extname", "host", "skip_pipeline").symbolize_keys
                          use_preload_links_header = options["preload_links_header"].nil? ? preload_links_header : options.delete("preload_links_header")
                          preload_links = []
                  Severity: Minor
                  Found in actionview/lib/action_view/helpers/asset_tag_helper.rb - About 3 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 javascript_include_tag has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def javascript_include_tag(*sources)
                          options = sources.extract_options!.stringify_keys
                          path_options = options.extract!("protocol", "extname", "host", "skip_pipeline").symbolize_keys
                          preload_links = []
                          use_preload_links_header = options["preload_links_header"].nil? ? preload_links_header : options.delete("preload_links_header")
                  Severity: Minor
                  Found in actionview/lib/action_view/helpers/asset_tag_helper.rb - About 3 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 find_in has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def find_in(dir)
                        results = {}
                  
                        Dir.glob("#{dir}/*") do |item|
                          next if File.basename(item).start_with?(".")
                  Severity: Minor
                  Found in railties/lib/rails/source_annotation_extractor.rb - About 3 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

                  Severity
                  Category
                  Status
                  Source
                  Language