Showing 1,176 of 1,233 total issues
Method get_damageEffect_table
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_damageEffect_table(hitPart, damageStage)
damageInfos = [['L', '(LW)'],
['M', '(MW)'],
['H', '(HW)'],
['O', '(MO)']]
Method check_action
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def check_action(command)
parser = Command::Parser.new("AB", round_type: RoundType::CEIL).has_prefix_number.enable_critical.enable_dollar.restrict_cmp_op_to(nil, :>=)
parsed = parser.parse(command)
return nil if parsed.nil?
- 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
Method ability_roll
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def ability_roll(command)
m = /^AR([-+]\d+)?(>=(\d+))?([AD]?)/.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 getStepResult
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
def getStepResult(str)
return nil unless /(\d+)E(\d+)?(\+)?(\d+)?(d\d+)?/i =~ str
stepTotal = 0
@isFailed = true
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
File AlchemiaStruggle.rb
has 305 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "bcdice/base"
module BCDice
module GameSystem
class AlchemiaStruggle < Base
Similar blocks of code found in 2 locations. Consider refactoring. Open
def mk_rare_item_table(num)
table = [
[11, "ブルーリボン"],
[12, "聖痕"],
[13, "剥製"],
- 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 116.
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 2 locations. Consider refactoring. Open
def mk_rare_weapon_item_table(num)
table = [
[11, "虚弾"],
[12, "怪物毒"],
[13, "小鬼の襟巻"],
- 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 116.
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 eval_game_system_specific_command
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def eval_game_system_specific_command(command)
difficulty = 6
auto_success = 0
enabled_reroll = false
enabled_reroll_with_botch = false
- 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 use_edible_plant_chart
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def use_edible_plant_chart(command)
match_data = command.match(/EP([VA]?)(\d?)/)
chart_symbol = match_data[1] == '' ? 'V' : match_data[1]
case chart_symbol
- 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_check
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def roll_check(command)
m = /^KS(?:\(([-+\d]+),([-+\d]+)?\)|(\d+))([AD]?)(?:>=([-+\d]+))?$/.match(command)
return nil unless m
dice_size = m[1] ? Arithmetic.eval(m[1], @round_type) : Arithmetic.eval(m[3], @round_type).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 fate_monster
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def fate_monster(_natural_result, order)
modified_result = []
if order.length > 9 && order[2] =~ /^\d+$/ && order[3] =~ /^\d+$/ && order[4] =~ /^\d+$/ && order[5] =~ /^\d+$/ && order[6] =~ /^\d+$/ && order[7] =~ /^\d+$/ && order[8] =~ /^\d+$/ && order[9] =~ /^\d+$/
if order[2].to_i > 0
modified_result.concat(@randomizer.roll_barabara(order[2].to_i, 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 getStepResult
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def getStepResult(str)
return nil unless /(\d+)E(\d+)?(\+)?(\d+)?(d\d+)?/i =~ str
stepTotal = 0
@isFailed = true
- 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 FilledWith.rb
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
module BCDice
module GameSystem
class FilledWith < Base
# ゲームシステムの識別子
ID = 'FilledWith'
Method resolute_action
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def resolute_action(command)
m = /^(\d*)([+\d]+)*FF<=(\d)(,(\d))?(&(\d))?$/.match(command)
return nil unless m
heat_level = 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
File LiveraDoll.rb
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
module BCDice
module GameSystem
class LiveraDoll < Base
# ゲームシステムの識別子
ID = 'LiveraDoll'
File BeastBindTrinity.rb
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'bcdice/arithmetic_evaluator'
require 'bcdice/format'
require 'bcdice/normalize'
require 'bcdice/dice_table/table'
require 'bcdice/dice_table/d66_grid_table'
File Warhammer.rb
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
module BCDice
module GameSystem
class Warhammer < Base
# ゲームシステムの識別子
ID = 'Warhammer'
Method getFumbleTypeAndTable
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
def getFumbleTypeAndTable(head)
case head
when "S"
type = '射撃'
# 射撃ファンブル表