dry-rb/dry-core

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

Summary

Maintainability
A
35 mins
Test Coverage
A
100%

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

Space inside string interpolation detected.
Open

            raise ParentClassMismatch, "#{ existing.name } must be a subclass of #{ parent.name }"
Severity: Minor
Found in lib/dry/core/class_builder.rb by rubocop

This cop checks for whitespace within string interpolations.

Example: EnforcedStyle: no_space (default)

# bad
   var = "This is the #{ space } example"

# good
   var = "This is the #{no_space} example"

Example: EnforcedStyle: space

# bad
   var = "This is the #{no_space} example"

# good
   var = "This is the #{ space } example"

Do not suppress exceptions.
Open

        rescue NameError
Severity: Minor
Found in lib/dry/core/class_builder.rb by rubocop

This cop checks for rescue blocks with no body.

Example:

# bad

def some_method
  do_something
rescue
  # do nothing
end

Example:

# bad

begin
  do_something
rescue
  # do nothing
end

Example:

# good

def some_method
  do_something
rescue
  handle_exception
end

Example:

# good

begin
  do_something
rescue
  handle_exception
end

Space inside string interpolation detected.
Open

            raise ParentClassMismatch, "#{ existing.name } must be a subclass of #{ parent.name }"
Severity: Minor
Found in lib/dry/core/class_builder.rb by rubocop

This cop checks for whitespace within string interpolations.

Example: EnforcedStyle: no_space (default)

# bad
   var = "This is the #{ space } example"

# good
   var = "This is the #{no_space} example"

Example: EnforcedStyle: space

# bad
   var = "This is the #{no_space} example"

# good
   var = "This is the #{ space } example"

There are no issues that match your filters.

Category
Status