Showing 837 of 1,278 total issues
Method getStepResultInfos
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def getStepResultInfos(str)
steps = []
calcs = []
totals = []
target = 0
- 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 roll_f
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def roll_f(command)
parser = Command::Parser.new(/F(\d+)(\+\d+)*(-\d+)*/, round_type: RoundType::CEIL)
.disable_modifier
.enable_critical
cmd = parser.parse(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
Method getCheckResultText
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def getCheckResultText(total, diff, fumbleable = false)
if total <= diff
return "決定性的成功" if total == 1
return "極限的成功" if total <= (diff / 5)
return "困難的成功" if total <= (diff / 2)
- 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 resolute_action
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def resolute_action(command)
m = /^TC([+\d]*)(>=(\d+))?/.match(command)
return nil unless m
bonus =
- 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 proc_dice_2nd
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def proc_dice_2nd(match)
output_text = ''
total_success_num = 0
difficulty = DIFFICULTY_SYMBOL_TO_INTEGER.fetch(match[1])
Method check_roll
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_roll(command, base, target, critical_target, diff, modifier)
if base <= 0 # クリティカルしない1D
critical_target = 0
base = 1
end
Method checkRoll
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def checkRoll(command)
debug("checkRoll begin command", command)
result = Result.new
result.text = ''
Method get_roll_result
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_roll_result(result_text, success_dice, ten_dice, _rage_ten_dice, brutal_outcome, difficulty)
is_critical = ten_dice >= 2
if brutal_outcome > 0 && difficulty != 0
success_dice += 4
Method execute
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute(randomizer)
if @critical_value < 3
return translate("SwordWorld2_0.transcendent_critical_too_small", expression: @expression)
end
Method translate_tables
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def translate_tables(locale)
{
"ECT" => DiceTable::Table.from_i18n("Amadeus.table.ECT", locale),
"BST" => DiceTable::Table.from_i18n("Amadeus.table.BST", locale),
"RT" => DiceTable::Table.from_i18n("Amadeus.table.RT", locale),
Method checkRoll
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def checkRoll(rapid, target, damage, isCritical, criticalNumber)
totalSuccessCount = 0
totalCriticalCount = 0
text = ""
Method resolute_action
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def resolute_action(command)
parser = Command::Parser.new("LM", round_type: @round_type)
.has_suffix_number
.restrict_cmp_op_to(:>=)
parsed = parser.parse(command)
Method select_origin
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def select_origin(command)
order = command.split(",")
case order[0]
when "5HS4"
Method get_urge
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_urge(string)
m = /([NAMUC])?URGE\s*(\d+)/i.match(string)
unless m
return '1'
end
Method check_roll
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_roll(command)
m = /^(\d+)D6([+\-\d]*)>=(\?|\d+)(\[(\d+)?(,(\d+))?\])?$/i.match(command)
unless m
return nil
end
Method proc_nrs
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def proc_nrs(dice_num, dificulty_s, type)
# 難易度も乱数表の番号も指定が無ければコマンドミス
dificulty_i = dificulty_s.nil? ? 0 : DIFFICULTY_SYMBOL_TO_INTEGER.fetch(dificulty_s)
if dificulty_i == 0 && type == 0
return nil
Method resolute_initiative
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def resolute_initiative(command)
parser = Command::Parser.new("LI", round_type: @round_type)
.has_suffix_number
.restrict_cmp_op_to(:>=)
parsed = parser.parse(command)
Method roll_attack
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def roll_attack(power_expression, dice_count_expression, border_expression, modification_operator, modification_expression)
power = Arithmetic.eval(power_expression, RoundType::CEIL)
dice_count = Arithmetic.eval(dice_count_expression, RoundType::CEIL)
border = Arithmetic.eval(border_expression, RoundType::CEIL)
modification_value = modification_expression.nil? ? nil : Arithmetic.eval(modification_expression, RoundType::CEIL)
Method rollFullAuto
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def rollFullAuto(bullet_count, diff, broken_number, dice_num, stop_count, bullet_set_count_cap)
output = ""
loopCount = 0
counts = {
Method getStepResult
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def getStepResult(str)
return nil unless /^(\d+)E(\d+)?(\+(\d*)D(\d+))?(\+\d)?/i =~ str
stepTotal = 0
@isFailed = true