Showing 1,823 of 1,823 total issues

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

      def add_route(mapping, name)
        raise ArgumentError, "Invalid route name: '#{name}'" unless name.blank? || name.to_s.match(/^[_a-z]\w*$/i)

        if name && named_routes[name]
          raise ArgumentError, "Invalid route name, already in use: '#{name}' \n" \
Severity: Minor
Found in actionpack/lib/action_dispatch/routing/route_set.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 url_for has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def url_for(options, route_name = nil, url_strategy = UNKNOWN, method_name = nil, reserved = RESERVED_OPTIONS)
        options = default_url_options.merge options

        user = password = nil

Severity: Minor
Found in actionpack/lib/action_dispatch/routing/route_set.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 formats has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def formats
        fetch_header("action_dispatch.request.formats") do |k|
          v = if params_readable?
            Array(Mime[parameters[:format]])
          elsif use_accept_header && valid_accept_header
Severity: Minor
Found in actionpack/lib/action_dispatch/http/mime_negotiation.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 find_all has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def find_all(name, prefix = nil, partial = false, details = {}, key = nil, locals = [])
Severity: Minor
Found in actionview/lib/action_view/template/resolver.rb - About 45 mins to fix

    Method _find_all has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def _find_all(name, prefix, partial, details, key, locals)
    Severity: Minor
    Found in actionview/lib/action_view/template/resolver.rb - About 45 mins to fix

      Method _find_all has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def _find_all(name, prefix, partial, details, key, locals)
      Severity: Minor
      Found in actionview/lib/action_view/template/resolver.rb - About 45 mins to fix

        Method render_collection has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def render_collection(collection, view, path, template, layout, block)
        Severity: Minor
        Found in actionview/lib/action_view/renderer/collection_renderer.rb - About 45 mins to fix

          Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  def initialize(object_name, method_name, template_object, choices, options, html_options)
          Severity: Minor
          Found in actionview/lib/action_view/helpers/tags/select.rb - About 45 mins to fix

            Method find has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def find(path, prefixes, partial, details, details_key, locals)
            Severity: Minor
            Found in actionview/lib/action_view/path_set.rb - About 45 mins to fix

              Method cut_excerpt_part has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                      def cut_excerpt_part(part_position, part, separator, options)
                        return "", "" unless part
              
                        radius   = options.fetch(:radius, 100)
                        omission = options.fetch(:omission, "...")
              Severity: Minor
              Found in actionview/lib/action_view/helpers/text_helper.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 exists? has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def exists?(path, prefixes, partial, details, details_key, locals)
              Severity: Minor
              Found in actionview/lib/action_view/path_set.rb - About 45 mins to fix

                Method render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                        def render
                          options = @options.stringify_keys
                
                          if options["autosave"]
                            if options["autosave"] == true
                Severity: Minor
                Found in actionview/lib/action_view/helpers/tags/search_field.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        def initialize(object_name, method_name, template_object, priority_zones, options, html_options)
                Severity: Minor
                Found in actionview/lib/action_view/helpers/tags/time_zone_select.rb - About 45 mins to fix

                  Method escape_unsafe_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def escape_unsafe_options(options)
                            options[:format]          = ERB::Util.html_escape(options[:format]) if options[:format]
                            options[:negative_format] = ERB::Util.html_escape(options[:negative_format]) if options[:negative_format]
                            options[:separator]       = ERB::Util.html_escape(options[:separator]) if options[:separator]
                            options[:delimiter]       = ERB::Util.html_escape(options[:delimiter]) if options[:delimiter]
                  Severity: Minor
                  Found in actionview/lib/action_view/helpers/number_helper.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 convert_options_to_data_attributes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def convert_options_to_data_attributes(options, html_options)
                            if html_options
                              html_options = html_options.stringify_keys
                              html_options["data-remote"] = "true" if link_to_remote_options?(options) || link_to_remote_options?(html_options)
                  
                  
                  Severity: Minor
                  Found in actionview/lib/action_view/helpers/url_helper.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 render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def render(options = {}, locals = {}, &block)
                          case options
                          when Hash
                            in_rendering_context(options) do |renderer|
                              if block_given?
                  Severity: Minor
                  Found in actionview/lib/action_view/helpers/rendering_helper.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 encode! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def encode!
                        source = self.source
                  
                        return source unless source.encoding == Encoding::BINARY
                  
                  
                  Severity: Minor
                  Found in actionview/lib/action_view/template.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 find_all has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def find_all(path, prefixes, partial, details, details_key, locals)
                  Severity: Minor
                  Found in actionview/lib/action_view/path_set.rb - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language