actionpack/lib/action_dispatch/routing/mapper.rb

Summary

Maintainability
F
1 wk
Test Coverage

File mapper.rb has 1186 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "active_support/core_ext/hash/slice"
require "active_support/core_ext/enumerable"
require "active_support/core_ext/array/extract_options"
require "active_support/core_ext/regexp"
require "action_dispatch/routing/redirection"
Severity: Major
Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 3 days to fix

    Class Mapper has 85 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Mapper
          class BacktraceCleaner < ActiveSupport::BacktraceCleaner # :nodoc:
            def initialize
              super
              remove_silencers!
    Severity: Major
    Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 day to fix

      Method scope has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

              def scope(*args)
                options = args.extract_options!.dup
                scope = {}
      
                options[:path] = args.flatten.join("/") if args.any?
      Severity: Minor
      Found in actionpack/lib/action_dispatch/routing/mapper.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 Mapping has 26 methods (exceeds 20 allowed). Consider refactoring.
      Open

            class Mapping # :nodoc:
              ANCHOR_CHARACTERS_REGEX = %r{\A(\\A|\^)|(\\Z|\\z|\$)\Z}
              OPTIONAL_FORMAT_REGEX = %r{(?:\(\.:format\)+|\.:format|/)\Z}
      
              attr_reader :path, :requirements, :defaults, :to, :default_controller,
      Severity: Minor
      Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 3 hrs to fix

        Method resources has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

                def resources(*resources, &block)
                  options = resources.extract_options!.dup
        
                  if apply_common_behavior_for(:resources, resources, options, &block)
                    return self
        Severity: Minor
        Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 2 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 match has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

                def match(path, *rest, &block)
                  if rest.empty? && Hash === path
                    options  = path
                    path, to = options.find { |name, _value| name.is_a?(String) }
        
        
        Severity: Minor
        Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 hr 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 scope has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def scope(*args)
                  options = args.extract_options!.dup
                  scope = {}
        
                  options[:path] = args.flatten.join("/") if args.any?
        Severity: Minor
        Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 hr to fix

          Method resource has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

                  def resource(*resources, &block)
                    options = resources.extract_options!.dup
          
                    if apply_common_behavior_for(:resource, resources, options, &block)
                      return self
          Severity: Minor
          Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 hr 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 verify_regexp_requirements has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

                    def verify_regexp_requirements(requirements, wildcard_options)
                      requirements.each do |requirement, regex|
                        next unless regex.is_a? Regexp
          
                        if ANCHOR_CHARACTERS_REGEX.match?(regex.source)
          Severity: Minor
          Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 hr 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 route_source_location has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

                      def route_source_location
                        if Mapper.route_source_locations
                          action_dispatch_dir = File.expand_path("..", __dir__)
                          caller_locations.each do |location|
                            next if location.path.start_with?(action_dispatch_dir)
          Severity: Minor
          Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 hr 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 route_source_location has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

                      def route_source_location
                        if Mapper.route_source_locations
                          action_dispatch_dir = File.expand_path("..", __dir__)
                          Thread.each_caller_location do |location|
                            next if location.path.start_with?(action_dispatch_dir)
          Severity: Minor
          Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 hr 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 normalize_options! has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

                    def normalize_options!(options, path_params, modyoule)
                      if path_params.include?(:controller)
                        raise ArgumentError, ":controller segment is not allowed within a namespace block" if modyoule
          
                        # Add a default constraint for :controller path segments that matches namespaced
          Severity: Minor
          Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 hr 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 initialize has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def initialize(set:, ast:, controller:, default_action:, to:, formatted:, via:, options_constraints:, anchor:, scope_params:, options:)
                    @defaults           = scope_params[:defaults]
                    @set                = set
                    @to                 = intern(to)
                    @default_controller = intern(controller)
          Severity: Minor
          Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 hr to fix

            Method build has 11 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    def self.build(scope, set, ast, controller, default_action, to, via, formatted, options_constraints, anchor, options)
            Severity: Major
            Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 hr to fix

              Method map_match has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                        def map_match(paths, options)
                          if (on = options[:on]) && !VALID_ON_OPTIONS.include?(on)
                            raise ArgumentError, "Unknown scope #{on.inspect} given to :on"
                          end
              
              
              Severity: Minor
              Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 hr to fix

                Method map_match has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                          def map_match(paths, options)
                            if (on = options[:on]) && !VALID_ON_OPTIONS.include?(on)
                              raise ArgumentError, "Unknown scope #{on.inspect} given to :on"
                            end
                
                
                Severity: Minor
                Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 hr 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 mount has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                        def mount(app, options = nil)
                          if options
                            path = options.delete(:at)
                          elsif Hash === app
                            options = app
                Severity: Minor
                Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 hr 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 name_for_action has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                          def name_for_action(as, action)
                            prefix = prefix_name_for_action(as, action)
                            name_prefix = @scope[:as]
                
                            if parent_resource
                Severity: Minor
                Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 hr 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 add_route has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                          def add_route(action, controller, options, _path, to, via, formatted, anchor, options_constraints)
                Severity: Major
                Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 hr to fix

                  Method decomposed_match has 9 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                            def decomposed_match(path, controller, options, _path, to, via, formatted, anchor, options_constraints)
                  Severity: Major
                  Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 hr to fix

                    Method add_route has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                              def add_route(action, controller, options, _path, to, via, formatted, anchor, options_constraints)
                                path = path_for_action(action, _path)
                                raise ArgumentError, "path is required" if path.blank?
                    
                                action = action.to_s
                    Severity: Minor
                    Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 hr 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 match has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            def match(path, *rest, &block)
                              if rest.empty? && Hash === path
                                options  = path
                                path, to = options.find { |name, _value| name.is_a?(String) }
                    
                    
                    Severity: Minor
                    Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 hr to fix

                      Method apply_common_behavior_for has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                def apply_common_behavior_for(method, resources, options, &block)
                                  if resources.length > 1
                                    resources.each { |r| public_send(method, r, options, &block) }
                                    return true
                                  end
                      Severity: Minor
                      Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 hr to fix

                        Method initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                                def initialize(set:, ast:, controller:, default_action:, to:, formatted:, via:, options_constraints:, anchor:, scope_params:, options:)
                                  @defaults           = scope_params[:defaults]
                                  @set                = set
                                  @to                 = intern(to)
                                  @default_controller = intern(controller)
                        Severity: Minor
                        Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 55 mins 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 define_generate_prefix has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                                  def define_generate_prefix(app, name)
                                    _route = @set.named_routes.get name
                                    _routes = @set
                                    _url_helpers = @set.url_helpers
                        
                        
                        Severity: Minor
                        Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 45 mins 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 apply_common_behavior_for has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                                  def apply_common_behavior_for(method, resources, options, &block)
                                    if resources.length > 1
                                      resources.each { |r| public_send(method, r, options, &block) }
                                      return true
                                    end
                        Severity: Minor
                        Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 45 mins 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 set_member_mappings_for_resource has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                                  def set_member_mappings_for_resource # :doc:
                                    member do
                                      get :edit if parent_resource.actions.include?(:edit)
                                      get :show if parent_resource.actions.include?(:show)
                                      if parent_resource.actions.include?(:update)
                        Severity: Minor
                        Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 45 mins 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 decomposed_match has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                                  def decomposed_match(path, controller, options, _path, to, via, formatted, anchor, options_constraints)
                                    if on = options.delete(:on)
                                      send(on) { decomposed_match(path, controller, options, _path, to, via, formatted, anchor, options_constraints) }
                                    else
                                      case @scope.scope_level
                        Severity: Minor
                        Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 35 mins 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 nested has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                                def nested(&block)
                                  unless resource_scope?
                                    raise ArgumentError, "can't use nested outside resource(s) scope"
                                  end
                        
                        
                        Severity: Minor
                        Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 25 mins 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 add_controller_module has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                                  def add_controller_module(controller, modyoule)
                                    if modyoule && !controller.is_a?(Regexp)
                                      if controller&.start_with?("/")
                                        -controller[1..-1]
                                      else
                        Severity: Minor
                        Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 25 mins 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 root has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                                def root(path, options = {})
                                  if path.is_a?(String)
                                    options[:to] = path
                                  elsif path.is_a?(Hash) && options.empty?
                                    options = path
                        Severity: Minor
                        Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 25 mins 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

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                                          next if location.path.start_with?(action_dispatch_dir)
                        
                                          cleaned_path = Mapper.backtrace_cleaner.clean_frame(location.path)
                                          next if cleaned_path.nil?
                        
                        
                        Severity: Minor
                        Found in actionpack/lib/action_dispatch/routing/mapper.rb and 1 other location - About 15 mins to fix
                        actionpack/lib/action_dispatch/routing/mapper.rb on lines 378..383

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 25.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                                          next if location.path.start_with?(action_dispatch_dir)
                        
                                          cleaned_path = Mapper.backtrace_cleaner.clean_frame(location.path)
                                          next if cleaned_path.nil?
                        
                        
                        Severity: Minor
                        Found in actionpack/lib/action_dispatch/routing/mapper.rb and 1 other location - About 15 mins to fix
                        actionpack/lib/action_dispatch/routing/mapper.rb on lines 393..398

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 25.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        There are no issues that match your filters.

                        Category
                        Status