dry-rb/dry-core

View on GitHub

Showing 7 of 7 total issues

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

      def defines(*args, type: ::Object, coerce: IDENTITY)
        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 to_declaration has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def to_declaration(params, lookup = params.to_h)
          params.map do |type, name|
            case type
            when :req
              name
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 defines has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def defines(*args, type: ::Object, coerce: IDENTITY)
        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
            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 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(
                "#{self.name}##{old_name}",
                new_name ? "#{self.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_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(
                "#{self.name}.#{old_name}",
                new_name ? "#{self.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