File StellarLife.rb
has 332 lines of code (exceeds 250 allowed). Consider refactoring. Open
module BCDice
module GameSystem
class StellarLife < Base
# ゲームシステムの識別子
ID = 'StellarLife'
Method getJudgeResult
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def getJudgeResult(command)
case command
when /(\d+)?DA([\d+*-]*\d)?\[(\d+),(\d+)(,(\d+))?\]/i
number = (Regexp.last_match(1) || 1).to_i
correction = (Regexp.last_match(2) || 0).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 getJudgeResult
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def getJudgeResult(command)
case command
when /(\d+)?DA([\d+*-]*\d)?\[(\d+),(\d+)(,(\d+))?\]/i
number = (Regexp.last_match(1) || 1).to_i
correction = (Regexp.last_match(2) || 0).to_i
Similar blocks of code found in 6 locations. Consider refactoring. Wontfix
'TRAT' => StellarLife2D10Table.new(
'お宝形容表',
'ブレスト(価値+3)', 'ホーリー(価値+1)', 'ワンダフル(価値+1)', 'シャイニング(価値+1)', 'スーパー(価値+1)', 'エクセレント(価値+1)', 'グロリアス(価値+1)', 'グレート(価値+1)', 'フラワリー(価値+1)', 'ミラクル(価値+2)',
'アース(価値+1)', 'サバンナ(価値+1)', 'マウンテン', 'リバー', 'フォレスト', 'ジャングル', 'デザート', 'ハイランド', 'レイク', 'オーシャン(価値+1)',
'スペース(価値+1)', 'コスモ', 'ワールド(価値+1)', 'ユニバーサル', 'スカイ', 'メテオール', 'コメット', 'ルナティック', 'プラネタリー', 'ステラー(価値+1)',
- 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 103.
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 6 locations. Consider refactoring. Wontfix
'TRMT' => StellarLife2D10Table.new(
'お宝外見表',
'ダイヤモンド(価値+3)', 'ジェイド(価値+1)', 'エメラルド(価値+1)', 'トパーズ(価値+1)', 'サファイア(価値+1)', 'ルビー(価値+1)', 'ガーネット(価値+1)', 'ラピスラズリ(価値+1)', 'アメジスト(価値+1)', 'スモーキークォーツ(価値+2)',
'ゴールデン(価値+1)', 'チタン(価値+1)', 'ブリキの', 'アイアン', 'スチール', '真鍮の', 'ブロンズ', 'カッパー', 'シルバー', 'プラチナ(価値+1)',
'マーブル(価値+1)', 'グラナイト', 'オブシディアン(価値+1)', 'スレート', 'ライムストーン', 'ガラス', 'リネン', 'ビロード', 'コットン', 'シルク(価値+1)',
- 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 103.
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 6 locations. Consider refactoring. Wontfix
'TROT' => StellarLife2D10Table.new(
'お宝物品表',
'フルート(価値+3)', 'オカリナ(価値+1)', 'ギター(価値+1)', 'ピアノ(価値+1)', 'ドラム(価値+1)', 'ティンパニー(価値+1)', '太鼓(価値+1)', 'トランペット(価値+1)', 'ハープ(価値+1)', 'マイク(価値+2)',
'ブランコ(価値+1)', '人形(価値+1)', 'シーソー', 'ベンチ', 'すべり台', 'ラケット', 'ミニカー', 'コースター', 'ボール', 'オーブ(価値+1)',
'皿(価値+1)', 'プレート', 'ティーセット(価値+1)', '箸', 'フォーク', 'スプーン', 'ナイフ', 'フライパン', '鍋', 'カップ(価値+1)',
- 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 103.
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 6 locations. Consider refactoring. Wontfix
'VNRT' => StellarLife2D10Table.new(
'船名後半表',
'ローズ', 'ダンデリオン', 'オーキッド', 'アザリア', 'スウォードリリー', 'アイリス', 'ラベンダー', 'プロテア', 'グラジオラス', 'マグノリア',
'ライナー', 'カッター', 'フライター', 'フェリー', 'バルジ', 'クルーザー', 'クラフト', 'リガー', 'キール', 'ヴェッセル',
'リミテッド', 'インク', 'マーチャント', 'エクスペディション', 'コンボイ', 'キャラバン', 'コマース', 'レティニュー', 'アドバイザリー', 'コンサルティング',
- 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 103.
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 6 locations. Consider refactoring. Wontfix
'TRST' => StellarLife2D10Table.new(
'お宝特徴表',
'恐竜を模した(価値+3)', 'ヘビを模した(価値+1)', '魚を模した(価値+1)', 'イヌを模した(価値+1)', 'ウマを模した(価値+1)', 'ネズミを模した(価値+1)', 'ウサギを模した(価値+1)', 'クマを模した(価値+1)', 'ネコを模した(価値+1)', '鳥を模した(価値+2)',
'触り心地の良い(価値+1)', 'ふかふかした(価値+1)', 'ふわふわの', '柔らかな', 'なめらかな', 'かすかに震える', 'とげとげした', '硬質な', 'ザラッとした', '持ちやすい(価値+1)',
'美しい(価値+1)', 'きれいな', '麗しの(価値+1)', '華美な', '派手な', 'ほのかに発光する', '色とりどりの', '鮮やかな', '変化に富む', '可憐な(価値+1)',
- 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 103.
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 6 locations. Consider refactoring. Wontfix
'VNFT' => StellarLife2D10Table.new(
'船名前半表',
'ブラック', 'ホワイト', 'レッド', 'ブルー', 'グリーン', 'パープル', 'ライラック', 'ブラウン', 'シルバー', 'ゴールド',
'ネイビー', 'マリン', 'オーシャン', 'アクア', 'セイル', 'アンカー', 'パイレーツ', 'プライヴァティア', 'アルマダ', 'フロティラ',
'ギャリソン', 'タンク', 'センチネル', 'スクァッド', 'トループ', 'フロント', 'オフェンシブ', 'ヴァンガード', 'オーダー', 'フラッグ',
- 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 103.
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. Wontfix
'RET' => StellarLife2D10HalfTable.new(
'ランダムイベント表',
[
['燃料1 《周辺探索》成功数0~1では推進剤[1D10×30]獲得', '鋼材1 《周辺探索》成功数0~1では鋼材[1D10×30]獲得', '金属塊 鋼材300を獲得', '砕けた惑星核 希少金属3を獲得', '大資源アステロイド 推進剤300、鋼材300を獲得'],
['燃料1 《周辺探索》成功数0~1では推進剤[1D10×30]獲得', '鋼材1 《周辺探索》成功数0~1では鋼材[1D10×30]獲得', 'S型アステロイド 鋼材400を獲得', '燃料1 《周辺探索》成功数0~1では推進剤[1D10×30]獲得', '氷火山アステロイド 推進剤300、希少金属1を獲得'],
- 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 64.
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. Wontfix
'RNST' => StellarLife2D10HalfTable.new(
'ランダムNPC艦表',
[
['装甲+20(HP+400)', '装甲+20(HP+400)', '〈電磁パルスフィールド〉1基', '〈中性粒子ビーム砲〉2基', '〈バリアフィールド〉2基'],
['装甲+20(HP+400)', '装甲+20(HP+400)', '〈電磁パルスフィールド〉1基', '〈高機動ミサイル〉2基', '〈バリアフィールド〉2基'],
- 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 64.
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
when /(\d+)?DA([\d+*-]*\d)?\[(\d+),(\d+)(,(\d+))?\]/i
number = (Regexp.last_match(1) || 1).to_i
correction = (Regexp.last_match(2) || 0).to_i
single = (Regexp.last_match(3) || 4).to_i
double = (Regexp.last_match(4) || 8).to_i
- 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 38.
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