Showing 1,176 of 1,233 total issues
Method getTresureTable
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
def getTresureTable(num)
case num
# 初級マイナス
when -1
table = [
Method getSW2_0_RatingTable
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
def getSW2_0_RatingTable
rate_sw2_0 = [
# 0
'*,0,0,0,1,2,2,3,3,4,4',
'*,0,0,0,1,2,3,3,3,4,4',
File item_table.rb
has 336 lines of code (exceeds 250 allowed). Consider refactoring. Open
module BCDice
module GameSystem
class MeikyuKingdom
# デバイスファクトリー(1D6)
def mk_device_factory_table()
File StellarLife.rb
has 332 lines of code (exceeds 250 allowed). Consider refactoring. Open
module BCDice
module GameSystem
class StellarLife < Base
# ゲームシステムの識別子
ID = 'StellarLife'
Method getDamageTypeAndTable
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
def getDamageTypeAndTable(head)
case head
when "S"
type = '射撃'
# 射撃ダメージペナルティー表
Method getDamageTypeAndTable
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
def getDamageTypeAndTable(head)
case head
when "S"
type = '射撃'
# 射撃ダメージペナルティー表
Method get_roll_result
has a Cognitive Complexity of 27 (exceeds 5 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
- 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 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
def eval_game_system_specific_command(string)
if /^\d+D\d+/i.match?(string)
return roll_action(string)
end
Method wh_atpos
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
def wh_atpos(pos_num, pos_type) # WHFRP2命中部位表
debug("wh_atpos begin pos_type", pos_type)
pos_2l = [
'二足',
15, '頭部',
File GURPS.rb
has 321 lines of code (exceeds 250 allowed). Consider refactoring. Open
module BCDice
module GameSystem
class GURPS < Base
# ゲームシステムの識別子
ID = 'GURPS'
File TrinitySeven.rb
has 319 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "bcdice/dice_table/table"
require "bcdice/format"
module BCDice
module GameSystem
File GundamSentinel.rb
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
module BCDice
module GameSystem
class GundamSentinel < Base
# ゲームシステムの識別子
ID = 'GundamSentinel'
Method getResultText
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def getResultText(rating_total, command, diceResults, diceResultTotals,
rateResults, dice_total, round)
sequence = []
sequence.push("2D:[#{diceResults.join(' ')}]=#{diceResultTotals.join(',')}")
- 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 result_1d20
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def result_1d20(total, _dice_total, cmp_op, diff)
return Result.nothing if diff == '?'
return nil unless 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"
Further reading
Method checkRoll
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def checkRoll(diceCount, modify, critical, fumble, target, isStormy, optionalText)
isAnticipation = optionalText.include?('A') # 先見の明
isHeavyAttack = optionalText.include?('H') # 重撃
dice_list = @randomizer.roll_barabara(diceCount, 20)
- 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 getRollResult
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def getRollResult(rerollCounts, judgeNumberText, judgeNumber, targetNumber, isReRoll, isStop)
bitList = []
successList = []
countOneList = []
rerollTargetList = []
- 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 enemy_data_tables.rb
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
module BCDice
module GameSystem
class FilledWith < Base
# 夢幻の迷宮エネミーデータ表
def fetch_enemy_data(command)
Class ShinkuuGakuen
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class ShinkuuGakuen < Base
# ゲームシステムの識別子
ID = 'ShinkuuGakuen'
# ゲームシステム名
Similar blocks of code found in 2 locations. Consider refactoring. Open
def getDamageTypeAndTable(head)
case head
when "S"
type = '射撃'
# 射撃ダメージペナルティー表
- 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 122.
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 getDamageTypeAndTable(head)
case head
when "S"
type = '射撃'
# 射撃ダメージペナルティー表
- 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 122.
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