packetmonkey/bag_of_holding

View on GitHub

Showing 5 of 9 total issues

Method == has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def ==(other)
        begin
          return false unless count == other.count
          return false unless die == other.die
          return false unless label == other.label
Severity: Minor
Found in lib/bag_of_holding/dice/pool.rb - About 55 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 == has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def ==(other)
        begin
          return false unless left_result == other.left_result
          return false unless right_result == other.right_result
          return false unless operation == other.operation
Severity: Minor
Found in lib/bag_of_holding/dice/operation_result.rb - About 55 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 roll has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def roll
        loop do
          self.current_roll = rng
          result.add_roll current_roll

Severity: Minor
Found in lib/bag_of_holding/dice/die_roller.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

Avoid too many return statements within this method.
Open

          return false
Severity: Major
Found in lib/bag_of_holding/dice/pool.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

              return false
    Severity: Major
    Found in lib/bag_of_holding/dice/operation_result.rb - About 30 mins to fix
      Severity
      Category
      Status
      Source
      Language