Showing 1,217 of 1,274 total issues
Method eval_game_system_specific_command
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def eval_game_system_specific_command(command)
if command =~ /(-)?(\d+)?RD(\d+)?(@(\d+))?$/i
diceCount = (Regexp.last_match(2) || 1).to_i
diceCount *= -1 unless Regexp.last_match(1).nil?
choiceCount = (Regexp.last_match(3) || 1).to_i
- 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 getTotalResult
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def getTotalResult(bitList, successList, countOneList, targetNumber, isStop, canReRoll)
success = successList.inject { |sum, i| sum + i }
countOne = countOneList.inject { |sum, i| sum + i }
result = ""
- 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 GranCrest.rb
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
module BCDice
module GameSystem
class GranCrest < Base
# ゲームシステムの識別子
ID = 'GranCrest'
File game_system.rb
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "bcdice/game_system/AFF2e"
require "bcdice/game_system/AceKillerGene"
require "bcdice/game_system/Ainecadette"
require "bcdice/game_system/Airgetlamh"
require "bcdice/game_system/AlchemiaStruggle"
Similar blocks of code found in 3 locations. 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
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 88.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. 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
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 88.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
def rollStep(diceType, diceCount)
debug('rollStep diceType, diceCount, @calcText', diceType, diceCount, @calcText)
stepTotal = 0
return stepTotal unless diceCount > 0
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 88.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method roll_amadeus
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def roll_amadeus(command)
m = /^R([A-DS])([+\-\d]*)(@(\d))?((>=?)([+\-\d]*))?(@(\d))?$/i.match(command)
unless m
return nil
end
Identical blocks of code found in 2 locations. Consider refactoring. Open
class DeathChart
def initialize(name, chart)
@name = name
@chart = chart.freeze
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 87.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
class DeathChart
def initialize(name, chart)
@name = name
@chart = chart.freeze
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 87.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method ability_roll
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ability_roll(command)
m = /^AR([-+]\d+)?(>=(\d+))?([AD]?)/.match(command)
unless m
return nil
end
Method check_roll_loop
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def check_roll_loop(roll_times, min_suc, target, critical, fumble, is_critical_stop)
dice_str = ''
is_fumble = false
is_critical = false
total_suc = 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_judge
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def roll_judge(command)
m = /^TN(6|10)([CSBYA]*)$/.match(command)
unless m
return nil
end
- 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_attacking
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def resolute_attacking(command)
m = /^([-+]\d+)?AA<=(\d+)$/.match(command)
return nil unless m
num_bonus = m[1].to_i
- 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_game_system_specific_command
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
def eval_game_system_specific_command(command)
difficulty = 6
auto_success = 0
enabled_reroll = false
enabled_reroll_with_botch = false
File RuinBreakers.rb
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'bcdice/arithmetic_evaluator'
require 'bcdice/dice_table/table'
require 'bcdice/dice_table/range_table'
module BCDice
Class Cthulhu7th_Korean
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Cthulhu7th_Korean < Base
# ゲームシステムの識別子
ID = 'Cthulhu7th:Korean'
# ゲームシステム名
Class Cthulhu7th_ChineseTraditional
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Cthulhu7th_ChineseTraditional < Base
# ゲームシステムの識別子
ID = 'Cthulhu7th:ChineseTraditional'
# ゲームシステム名
Method getStructureEncounter
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def getStructureEncounter(number)
debug("getStructureEncounter number", number)
tables = [[1, ['船から降りてきた', '魚を売っている', '仕事で忙しそうな', '異国から来た', 'おもしろおかしい', '汗水流している']],
[2, ['おかしな格好をした', '歌を歌っている', 'ステキな笑顔をした', '日なたぼっこをしている', '悩んでいる', '旅をしている']],
Method roll_judge
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def roll_judge(command)
m = /^TN(6|10)([CSBYA]*)$/.match(command)
unless m
return nil
end