bcdice/BCDice

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

Summary

Maintainability
B
6 hrs
Test Coverage
A
95%

File BeastBindTrinity.rb has 293 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'bcdice/arithmetic_evaluator'
require 'bcdice/format'
require 'bcdice/normalize'
require 'bcdice/dice_table/table'
require 'bcdice/dice_table/d66_grid_table'
Severity: Minor
Found in lib/bcdice/game_system/BeastBindTrinity.rb - About 3 hrs to fix

    Method roll has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def roll(randomizer)
              if @parse_error
                return nil
              end
    
    
    Severity: Minor
    Found in lib/bcdice/game_system/BeastBindTrinity.rb - About 1 hr to fix

      Method parse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def parse()
                m = /^(\d+)(?:R6|BB6?)((?:[+-]\d+)+)?(?:%(-?\d+))?(?:@([+\-\d]+))?(?:#(A)?([+\-\d]+))?(?:\$([1-6]+))?(?:&([1-6]))?(?:([>=]+)(\d+))?$/.match(@command)
                unless m
                  @parse_error = true
                  return
      Severity: Minor
      Found in lib/bcdice/game_system/BeastBindTrinity.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

      Method roll has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def roll(randomizer)
                if @parse_error
                  return nil
                end
      
      
      Severity: Minor
      Found in lib/bcdice/game_system/BeastBindTrinity.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

      Method parse_critical has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def parse_critical(humanity, atmark)
                humanity = humanity ? humanity.to_i : 99
                atmark_value = atmark ? ArithmeticEvaluator.eval(atmark) : 0
      
                critical =
      Severity: Minor
      Found in lib/bcdice/game_system/BeastBindTrinity.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

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

              def calc_total
                total = @dice_total + @modify_number
                if fumble?
                  total = 0 unless @keep_value_on_fumble
                elsif critical?
      Severity: Minor
      Found in lib/bcdice/game_system/BeastBindTrinity.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

      There are no issues that match your filters.

      Category
      Status