Method getSW2_0_RatingTable
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
def getSW2_0_RatingTable
rate_sw2_0 = [
# 0
'*,0,0,0,1,2,2,3,3,4,4',
'*,0,0,0,1,2,3,3,3,4,4',
Method getResultText
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def getResultText(rating_total, command, diceResults, diceResultTotals,
rateResults, dice_total, round)
sequence = []
sequence.push("2D:[#{diceResults.join(' ')}]=#{diceResultTotals.join(',')}")
- 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 rating
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def rating(string) # レーティング表
debug("rating string", string)
command = rating_parser.parse(string)
unless command
- 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
File SwordWorld.rb
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "bcdice/base"
require "bcdice/game_system/sword_world/rating_parser"
module BCDice
module GameSystem
Method rating
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
def rating(string) # レーティング表
debug("rating string", string)
command = rating_parser.parse(string)
unless command
Method getResultText
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def getResultText(rating_total, command, diceResults, diceResultTotals,
rateResults, dice_total, round)
sequence = []
sequence.push("2D:[#{diceResults.join(' ')}]=#{diceResultTotals.join(',')}")
Method getNewRates
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def getNewRates(rate_sw2_0)
rate_3 = []
rate_4 = []
rate_5 = []
rate_6 = []
Method getResultText
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def getResultText(rating_total, command, diceResults, diceResultTotals,
rateResults, dice_total, round)
Method result_2d6
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def result_2d6(total, dice_total, _dice_list, cmp_op, target)
Method result_2d6
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def result_2d6(total, dice_total, _dice_list, cmp_op, target)
if dice_total >= 12
Result.critical(translate('SwordWorld.critical'))
elsif dice_total <= 2
Result.fumble(translate('SwordWorld.fumble'))
- 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"