dry-rb/dry-core

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

Summary

Maintainability
A
35 mins
Test Coverage
A
100%

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

Do not freeze immutable objects, as freezing them has no effect.
Open

      EMPTY_STRING = ''.freeze
Severity: Minor
Found in lib/dry/core/constants.rb by rubocop

This cop check for uses of Object#freeze on immutable objects.

Example:

# bad
CONST = 1.freeze

# good
CONST = 1

There are no issues that match your filters.

Category
Status