dry-rb/dry-types

View on GitHub
lib/dry/types.rb

Summary

Maintainability
A
1 hr
Test Coverage
A
93%

Method has too many lines. [23/22]
Open

    def self.[](name)
      type_map.fetch_or_store(name) do
        case name
        when ::String
          result = name.match(TYPE_SPEC_REGEX)
Severity: Minor
Found in lib/dry/types.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method [] has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def self.[](name)
      type_map.fetch_or_store(name) do
        case name
        when ::String
          result = name.match(TYPE_SPEC_REGEX)
Severity: Minor
Found in lib/dry/types.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

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

    TYPE_SPEC_REGEX = /(.+)<(.+)>/.freeze
Severity: Minor
Found in lib/dry/types.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