bcdice/BCDice

View on GitHub
lib/bcdice/game_system/Raisondetre.rb

Summary

Maintainability
C
1 day
Test Coverage
A
97%

Method checkRoll has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

      def checkRoll(diceCount, choiceCount, target)
        if diceCount <= 0
          correction = 1 + diceCount * -1
          rollCount = 1
        else
Severity: Minor
Found in lib/bcdice/game_system/Raisondetre.rb - About 2 hrs 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 eval_game_system_specific_command has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

      def eval_game_system_specific_command(command)
        if command =~ /(-)?(\d+)?RD(\d+)?(@(\d+))?$/i
          diceCount = (Regexp.last_match(2) || 1).to_i
          diceCount *= -1 unless Regexp.last_match(1).nil?
          choiceCount = (Regexp.last_match(3) || 1).to_i
Severity: Minor
Found in lib/bcdice/game_system/Raisondetre.rb - About 2 hrs 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 checkRoll has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def checkRoll(diceCount, choiceCount, target)
        if diceCount <= 0
          correction = 1 + diceCount * -1
          rollCount = 1
        else
Severity: Minor
Found in lib/bcdice/game_system/Raisondetre.rb - About 1 hr to fix

    Method checkDamage has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def checkDamage(diceCount, armor)
            if diceCount <= 0
              correction = 1 + diceCount * -1
              rollCount = 1
            else
    Severity: Minor
    Found in lib/bcdice/game_system/Raisondetre.rb - About 1 hr to fix

      Method checkDamage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def checkDamage(diceCount, armor)
              if diceCount <= 0
                correction = 1 + diceCount * -1
                rollCount = 1
              else
      Severity: Minor
      Found in lib/bcdice/game_system/Raisondetre.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

      There are no issues that match your filters.

      Category
      Status