bcdice/BCDice

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

Summary

Maintainability
D
1 day
Test Coverage
A
96%

File KillDeathBusiness.rb has 352 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module BCDice
  module GameSystem
    class KillDeathBusiness < Base
      # ゲームシステムの識別子
      ID = 'KillDeathBusiness'
Severity: Minor
Found in lib/bcdice/game_system/KillDeathBusiness.rb - About 4 hrs to fix

    Method judgeDice has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

          def judgeDice(command)
            fumble_match = /,(\d+)$/.match(command)
    
            parser = Command::Parser.new(/JD\d+/, round_type: round_type)
                                    .enable_critical
    Severity: Minor
    Found in lib/bcdice/game_system/KillDeathBusiness.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 judgeDice has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def judgeDice(command)
            fumble_match = /,(\d+)$/.match(command)
    
            parser = Command::Parser.new(/JD\d+/, round_type: round_type)
                                    .enable_critical
    Severity: Major
    Found in lib/bcdice/game_system/KillDeathBusiness.rb - About 2 hrs to fix

      Method getExtraTableResult has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def getExtraTableResult(type)
              tableName = translate("KillDeathBusiness.EXT.name")
              extraTable1 = [
                [11, translate("KillDeathBusiness.EXT.table1.11")],
                [12, translate("KillDeathBusiness.EXT.table1.12")],
      Severity: Minor
      Found in lib/bcdice/game_system/KillDeathBusiness.rb - About 1 hr to fix

        Method translate_tables has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def translate_tables(locale)
                  {
                    "HST" => DiceTable::Table.from_i18n("KillDeathBusiness.table.HST", locale),
                    "DWT" => DiceTable::Table.from_i18n("KillDeathBusiness.table.DWT", locale),
                    "RWT" => DiceTable::Table.from_i18n("KillDeathBusiness.table.RWT", locale),
        Severity: Minor
        Found in lib/bcdice/game_system/KillDeathBusiness.rb - About 1 hr to fix

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

                def rollTableCommand(command)
                  command = ALIAS[command] || command
                  result = roll_tables(command, self.class::TABLES) || self.class::RTT.roll_command(@randomizer, command)
                  return result if result
          
          
          Severity: Minor
          Found in lib/bcdice/game_system/KillDeathBusiness.rb - About 1 hr to fix

            Method result_2d6 has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def result_2d6(_total, dice_total, _dice_list, cmp_op, _target)
            Severity: Minor
            Found in lib/bcdice/game_system/KillDeathBusiness.rb - About 35 mins to fix

              There are no issues that match your filters.

              Category
              Status