dry-rb/dry-core

View on GitHub
lib/dry/core/memoizable.rb

Summary

Maintainability
B
6 hrs
Test Coverage

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 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

      There are no issues that match your filters.

      Category
      Status