lib/bcdice/game_system/KillDeathBusiness.rb
File KillDeathBusiness.rb
has 352 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module BCDice
module GameSystem
class KillDeathBusiness < Base
# ゲームシステムの識別子
ID = 'KillDeathBusiness'
Method judgeDice
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
def judgeDice(command)
fumble_match = /,(\d+)$/.match(command)
parser = Command::Parser.new(/JD\d+/, round_type: round_type)
.enable_critical
- Read upRead up
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
Open
def judgeDice(command)
fumble_match = /,(\d+)$/.match(command)
parser = Command::Parser.new(/JD\d+/, round_type: round_type)
.enable_critical
Method getExtraTableResult
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def getExtraTableResult(type)
tableName = translate("KillDeathBusiness.EXT.name")
extraTable1 = [
[11, translate("KillDeathBusiness.EXT.table1.11")],
[12, translate("KillDeathBusiness.EXT.table1.12")],
Method translate_tables
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
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),
Method rollTableCommand
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Method result_2d6
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def result_2d6(_total, dice_total, _dice_list, cmp_op, _target)