Showing 1,823 of 1,823 total issues

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

        def compute_table_name
          if base_class?
            # Nested classes are prefixed with singular parent table name.
            if module_parent < Base && !module_parent.abstract_class?
              contained = module_parent.table_name
Severity: Minor
Found in activerecord/lib/active_record/model_schema.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 build_column_serializer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

          def build_column_serializer(attr_name, coder, type, yaml = nil)
            # When ::JSON is used, force it to go through the Active Support JSON encoder
            # to ensure special objects (e.g. Active Record models) are dumped correctly
            # using the #as_json hook.
            coder = Coders::JSON if coder == ::JSON
Severity: Minor
Found in activerecord/lib/active_record/attribute_methods/serialization.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 assign_parameters has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def assign_parameters(routes, controller_path, action, parameters, generated_path, query_string_keys)
Severity: Minor
Found in actionpack/lib/action_controller/test_case.rb - About 45 mins to fix

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

          def write(string)
            unless @response.committed?
              @response.headers["Cache-Control"] ||= "no-cache"
              @response.delete_header "Content-Length"
            end
    Severity: Minor
    Found in actionpack/lib/action_controller/metal/live.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 join_constraints has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def join_constraints(joins_to_add, alias_tracker, references)
            @alias_tracker = alias_tracker
            @joined_tables = {}
            @references = {}
    
    
    Severity: Minor
    Found in activerecord/lib/active_record/associations/join_dependency.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 close has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def close(code = nil, reason = nil)
            code   ||= 1000
            reason ||= ""
    
            unless code == 1000 || (code >= 3000 && code <= 4999)
    Severity: Minor
    Found in actioncable/lib/action_cable/connection/client_socket.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 construct_model has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            def construct_model(record, node, row, model_cache, id, strict_loading_value)
    Severity: Minor
    Found in activerecord/lib/active_record/associations/join_dependency.rb - About 45 mins to fix

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

              def delete_records(records, method)
                ensure_not_nested
      
                scope = through_association.scope
                scope.where! construct_join_attributes(*records)

      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 construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def construct(ar_parent, parent, row, seen, model_cache, strict_loading_value)
      Severity: Minor
      Found in activerecord/lib/active_record/associations/join_dependency.rb - About 45 mins to fix

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

              def check_constraints_in_create(table, stream)
                if (check_constraints = @connection.check_constraints(table)).any?
                  add_check_constraint_statements = check_constraints.map do |check_constraint|
                    parts = [
                      "t.check_constraint #{check_constraint.expression.inspect}"
        Severity: Minor
        Found in activerecord/lib/active_record/schema_dumper.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(name, format, include, exclude, klass, model) # :nodoc:
        Severity: Minor
        Found in actionpack/lib/action_controller/metal/params_wrapper.rb - About 45 mins to fix

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

                  def initialize(klass, owners, reflection, preload_scope, reflection_scope, associate_by_default)
          Severity: Minor
          Found in activerecord/lib/active_record/associations/preloader/association.rb - About 45 mins to fix

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

                    def setup_request(controller_class_name, action, parameters, session, flash, xhr)
            Severity: Minor
            Found in actionpack/lib/action_controller/test_case.rb - About 45 mins to fix

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

                    def load_target
                      @target = find_target if (@stale_state && stale_target?) || find_target?
              
                      loaded! unless loaded?
                      target
              Severity: Minor
              Found in activerecord/lib/active_record/associations/association.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 table_name= has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def table_name=(value)
                      value = value && value.to_s
              
                      if defined?(@table_name)
                        return if value == @table_name
              Severity: Minor
              Found in activerecord/lib/active_record/model_schema.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 send_file has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def send_file(path, options = {}) # :doc:
                      raise MissingFile, "Cannot read file #{path}" unless File.file?(path) && File.readable?(path)
              
                      options[:filename] ||= File.basename(path) unless options[:url_based_filename]
                      send_file_headers! options
              Severity: Minor
              Found in actionpack/lib/action_controller/metal/data_streaming.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 stale_session_check! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def stale_session_check!
                      yield
                    rescue ArgumentError => argument_error
                      if argument_error.message =~ %r{undefined class/module ([\w:]*\w)}
                        begin
              Severity: Minor
              Found in actionpack/lib/action_dispatch/middleware/session/abstract_store.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(paths, path, prefixes, partial, details, *)
              Severity: Minor
              Found in actionview/lib/action_view/template/error.rb - About 45 mins to fix

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

                      def build_backtrace
                        built_methods = {}
                
                        ActionView::PathRegistry.all_resolvers.each do |resolver|
                          resolver.built_templates.each do |template|
                Severity: Minor
                Found in actionpack/lib/action_dispatch/middleware/exception_wrapper.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

                Severity
                Category
                Status
                Source
                Language