dry-rb/dry-core

View on GitHub

Showing 10 of 10 total issues

Method define_memoizable has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def define_memoizable(method:)
          parameters = method.parameters
          mod = self
          kernel = KERNEL

Severity: Major
Found in lib/dry/core/memoizable.rb - About 2 hrs to fix

    Method defines has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

          def defines(*args, type: ::Object, coerce: IDENTITY) # rubocop:disable Metrics/PerceivedComplexity
            unless coerce.respond_to?(:call)
              raise ::ArgumentError, "Non-callable coerce option: #{coerce.inspect}"
            end
    
    
    Severity: Minor
    Found in lib/dry/core/class_attributes.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 define_memoizable has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

            def define_memoizable(method:)
              parameters = method.parameters
              mod = self
              kernel = KERNEL
    
    
    Severity: Minor
    Found in lib/dry/core/memoizable.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 map_bind_type has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

            def map_bind_type(type, name, original_params, defined_types) # rubocop:disable Metrics/PerceivedComplexity
              case type
              when :req
                :reqular
              when :rest, :keyreq, :keyrest
    Severity: Minor
    Found in lib/dry/core/memoizable.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 map_bind_type has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def map_bind_type(type, name, original_params, defined_types) # rubocop:disable Metrics/PerceivedComplexity
              case type
              when :req
                :reqular
              when :rest, :keyreq, :keyrest
    Severity: Minor
    Found in lib/dry/core/memoizable.rb - About 1 hr to fix

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

            def defines(*args, type: ::Object, coerce: IDENTITY) # rubocop:disable Metrics/PerceivedComplexity
              unless coerce.respond_to?(:call)
                raise ::ArgumentError, "Non-callable coerce option: #{coerce.inspect}"
              end
      
      
      Severity: Minor
      Found in lib/dry/core/class_attributes.rb - About 1 hr to fix

        Method default has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def undefined.default(x, y = self)
                  if equal?(x)
                    if equal?(y)
                      yield
                    else
        Severity: Minor
        Found in lib/dry/core/constants.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 create_base has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def create_base(namespace, name, parent)
                begin
                  namespace.const_get(name)
                rescue NameError # rubocop:disable Lint/SuppressedException
                end
        Severity: Minor
        Found in lib/dry/core/class_builder.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 deprecate_class_method has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def deprecate_class_method(old_name, new_name = nil, message: nil)
                  full_msg = Deprecations.deprecated_name_message(
                    "#{name}.#{old_name}",
                    new_name ? "#{name}.#{new_name}" : nil,
                    message
        Severity: Minor
        Found in lib/dry/core/deprecations.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 deprecate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def deprecate(old_name, new_name = nil, message: nil)
                  full_msg = Deprecations.deprecated_name_message(
                    "#{name}##{old_name}",
                    new_name ? "#{name}##{new_name}" : nil,
                    message
        Severity: Minor
        Found in lib/dry/core/deprecations.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

        Severity
        Category
        Status
        Source
        Language