lib/bcdice/common_command/reroll_dice/node.rb
Method eval
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def eval(game_system, randomizer)
round_type = game_system.round_type
cmp_op = @cmp_op || game_system.default_cmp_op
reroll_cmp_op = @reroll_cmp_op || cmp_op || :>=
Method roll
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def roll(dice_queue, randomizer, reroll_condition, sort)
dice_list_list = []
loop_count = 0
while !dice_queue.empty? && loop_count < REROLL_LIMIT
- 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 eval
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def eval(game_system, randomizer)
round_type = game_system.round_type
cmp_op = @cmp_op || game_system.default_cmp_op
reroll_cmp_op = @reroll_cmp_op || cmp_op || :>=
- 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"