Showing 837 of 1,278 total issues
Method debug
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def debug(target, *values)
return unless @debug
targetStr = target.is_a?(String) ? target : target.inspect
- 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 check_action
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def check_action(command)
parser = Command::Parser.new("ZL", round_type: @round_type)
.enable_prefix_number
.disable_modifier
.restrict_cmp_op_to(:<=)
- 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 rollStep
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def rollStep(diceType, diceCount)
debug('rollStep diceType, diceCount, @string', diceType, diceCount, @string)
stepTotal = 0
return stepTotal unless diceCount > 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_attack
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def roll_attack(dice_count_expression, border_expression, additional_damage_rules)
dice_count = Arithmetic.eval(dice_count_expression, RoundType::FLOOR)
border = Arithmetic.eval(border_expression, RoundType::FLOOR).clamp(1, 6) if border_expression
command = make_command_text(dice_count, border, additional_damage_rules)
- 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 action_roll
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def action_roll(command)
parser = Command::Parser.new("D6", round_type: round_type)
.has_prefix_number
.restrict_cmp_op_to(:>=)
.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 getBulletResults
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def getBulletResults(bullet_count, hit_type, diff)
bullet_set_count = getSetOfBullet(diff)
hit_bullet_count_base = getHitBulletCountBase(diff, bullet_set_count)
impale_bullet_count_base = (bullet_set_count / 2.to_f)
Method eval_game_system_specific_command
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def eval_game_system_specific_command(command)
case command
when /CCB/i
# 5%
@critical_percentage = 5
Method result_2d6
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def result_2d6(total, dice_total, _dice_list, cmp_op, target)
return Result.nothing if target == '?'
return nil unless [:>=, :>].include?(cmp_op)
critical = false
Method checkRoll
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def checkRoll(diceCount, target, damage, criticalTrigger, criticalNumber)
totalSuccessCount = 0
totalCriticalCount = 0
text = ""
Method result_1d20
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def result_1d20(total, _dice_total, cmp_op, target)
return Result.nothing if target == '?'
return nil unless cmp_op == :<=
if total > target
Method rokumon2_roll
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def rokumon2_roll(mod, target, abl)
suc = 0
dice = @randomizer.roll_barabara(3 + mod.abs, 6).sort
dicestr = dice.join(",")
Method resolute_action
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def resolute_action(num_dices, defence, dice_change_text)
dices = @randomizer.roll_barabara(num_dices, 6).sort
dice_text = dices.join(",")
output = "(#{remake_command(num_dices, defence, dice_change_text)}) > #{dice_text}"
Method result_nd6
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def result_nd6(total, dice_total, dice_list, cmp_op, target)
return Result.nothing if target == '?'
return nil unless dice_list.size == 3 && cmp_op == :<=
success = target - total # 成功度
Method eval_game_system_specific_command
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def eval_game_system_specific_command(command)
command = command
.sub(/Lv(\d+)/i) { (Regexp.last_match(1).to_i * 5 - 1).to_s }
.sub(/NL(\d+)/i) { (Regexp.last_match(1).to_i * 5 + 5).to_s }
Method roll_investigate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def roll_investigate(command)
parser = Command::Parser.new("IN", round_type: @round_type)
.has_prefix_number
parsed = parser.parse(command)
unless parsed
Method result_detail
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def result_detail(sl, total, target)
if sl == 0
if total <= 5
'小成功'
elsif total >= 96
Method get_dice
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_dice(mod, abl, skl)
total = 0
crit = 0
fumble = 0
dice_c = 3 + mod.abs
Method checkRoll
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def checkRoll(diceCount, target, damage, criticalTrigger, criticalNumber)
totalSuccessCount = 0
totalCriticalCount = 0
text = ""
Method eval_game_system_specific_command
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def eval_game_system_specific_command(command)
m = /\A(\d+)?(((WAF)(\d+)(\+(\d+))?)|((WAI)(\d+)(R(\d+))?))$/.match(command)
unless m
return ''
end
Method get_develop_matome_table
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_develop_matome_table
output1 = ''
output2 = ''
total_n2 = ""