jfinkhaeuser/unobtainium-cucumber

View on GitHub

Showing 5 of 5 total issues

Method register_action has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def register_action(status, action = nil, options = nil, &block)
        # If the action is a Hash, then the options should be nil. If that's
        # the case, we have no action and instead got passed options.
        if action.is_a? Hash
          if not options.nil?
Severity: Minor
Found in lib/unobtainium-cucumber/status_actions.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 register_action has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def register_action(status, action = nil, options = nil, &block)
        # If the action is a Hash, then the options should be nil. If that's
        # the case, we have no action and instead got passed options.
        if action.is_a? Hash
          if not options.nil?
Severity: Minor
Found in lib/unobtainium-cucumber/status_actions.rb - About 1 hr to fix

    Method execute_action has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def execute_action(world, action, scenario)
            # Simplest case first: the action is already callable.
            if action.respond_to?(:call)
              return action.call(world, scenario)
            end
    Severity: Minor
    Found in lib/unobtainium-cucumber/status_actions.rb - About 1 hr to fix

      Method register_config_actions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def register_config_actions(world)
              to_register = world.config['cucumber.status_actions'] || DEFAULTS
      
              %i[passed? failed?].each do |status|
                for_status = to_register[status]
      Severity: Minor
      Found in lib/unobtainium-cucumber/status_actions.rb - About 45 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

      Method execute_action has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def execute_action(world, action, scenario)
              # Simplest case first: the action is already callable.
              if action.respond_to?(:call)
                return action.call(world, scenario)
              end
      Severity: Minor
      Found in lib/unobtainium-cucumber/status_actions.rb - About 45 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

      Severity
      Category
      Status
      Source
      Language