decko-commons/decko

View on GitHub
card/spec/card/director_spec.rb

Summary

Maintainability
A
3 hrs
Test Coverage

File director_spec.rb has 302 lines of code (exceeds 250 allowed). Consider refactoring.
Open

RSpec.describe "Card::Director" do
  STAGE_MAP = { VI: :initialize,
                VP: :prepare_to_validate,
                VV: :validate,
                SP: :prepare_to_store,
Severity: Minor
Found in card/spec/card/director_spec.rb - About 3 hrs to fix

Method define_test_event has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def define_test_event stage, subcard
        test_event stage, on: :create do
          yield name
          subcard "112v" if subcard && name == "11"
        end
Severity: Minor
Found in card/spec/card/director_spec.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

The first argument to describe should be the class or module being tested.
Open

RSpec.describe "Card::Director" do
Severity: Minor
Found in card/spec/card/director_spec.rb by rubocop

Do not suppress exceptions.
Open

      rescue Card::Error
Severity: Minor
Found in card/spec/card/director_spec.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

There are no issues that match your filters.

Category
Status