bcdice/BCDice

View on GitHub
lib/bcdice/game_system/AlterRaise.rb

Summary

Maintainability
C
1 day
Test Coverage
A
100%

Method get_AlterRaise_d66_table_result has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def get_AlterRaise_d66_table_result(name, table, roc)
        if roc > 10
          diceText = roc.to_s
          dice1 = diceText[0, 1].to_i
          dice1 = 6 if dice1 > 6
Severity: Minor
Found in lib/bcdice/game_system/AlterRaise.rb - About 1 hr to fix

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 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def eval_game_system_specific_command(command)
        output =
          case command.upcase

          when /EMA(\d+)?$/i
Severity: Minor
Found in lib/bcdice/game_system/AlterRaise.rb - About 1 hr to fix

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

          def get_delight_table(roc)
            name = "喜び・経験表"
            table = [
              [13, '勝利'],
              [16, '優勝'],
    Severity: Major
    Found in lib/bcdice/game_system/AlterRaise.rb and 4 other locations - About 1 hr to fix
    lib/bcdice/game_system/AlterRaise.rb on lines 127..143
    lib/bcdice/game_system/AlterRaise.rb on lines 146..162
    lib/bcdice/game_system/AlterRaise.rb on lines 184..200
    lib/bcdice/game_system/AlterRaise.rb on lines 229..245

    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 47.

    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

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

          def get_quiet_table(roc)
            name = "平穏・経験表"
            table = [
              [13, '友達'],
              [16, '幼馴染み'],
    Severity: Major
    Found in lib/bcdice/game_system/AlterRaise.rb and 4 other locations - About 1 hr to fix
    lib/bcdice/game_system/AlterRaise.rb on lines 127..143
    lib/bcdice/game_system/AlterRaise.rb on lines 165..181
    lib/bcdice/game_system/AlterRaise.rb on lines 184..200
    lib/bcdice/game_system/AlterRaise.rb on lines 229..245

    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 47.

    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

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

          def get_emotion_table(roc)
            name = "感情表"
            table = [
              [13, '勇気'],
              [16, '怒り'],
    Severity: Major
    Found in lib/bcdice/game_system/AlterRaise.rb and 4 other locations - About 1 hr to fix
    lib/bcdice/game_system/AlterRaise.rb on lines 127..143
    lib/bcdice/game_system/AlterRaise.rb on lines 146..162
    lib/bcdice/game_system/AlterRaise.rb on lines 165..181
    lib/bcdice/game_system/AlterRaise.rb on lines 184..200

    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 47.

    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

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

          def get_location_table(roc)
            name = "場所表"
            table = [
              [13, '教室'],
              [16, '部室'],
    Severity: Major
    Found in lib/bcdice/game_system/AlterRaise.rb and 4 other locations - About 1 hr to fix
    lib/bcdice/game_system/AlterRaise.rb on lines 146..162
    lib/bcdice/game_system/AlterRaise.rb on lines 165..181
    lib/bcdice/game_system/AlterRaise.rb on lines 184..200
    lib/bcdice/game_system/AlterRaise.rb on lines 229..245

    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 47.

    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

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

          def get_trauma_table(roc)
            name = "心の傷・経験表"
            table = [
              [13, '敗北'],
              [16, '仲違い'],
    Severity: Major
    Found in lib/bcdice/game_system/AlterRaise.rb and 4 other locations - About 1 hr to fix
    lib/bcdice/game_system/AlterRaise.rb on lines 127..143
    lib/bcdice/game_system/AlterRaise.rb on lines 146..162
    lib/bcdice/game_system/AlterRaise.rb on lines 165..181
    lib/bcdice/game_system/AlterRaise.rb on lines 229..245

    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 47.

    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

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

          def get_scene_production_table(roc)
            name = "シーン演出表"
            table = [
              [1, '相談。君は相手に相談したいことがあった。'],
              [2, '遊び。君は相手と遊びたかった。'],
    Severity: Minor
    Found in lib/bcdice/game_system/AlterRaise.rb and 2 other locations - About 25 mins to fix
    lib/bcdice/game_system/AlterRaise.rb on lines 114..124
    lib/bcdice/game_system/AlterRaise.rb on lines 216..226

    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 29.

    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

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

          def get_stance_table(roc)
            name = "スタンス表"
            table = [
              [1, '友人'],
              [2, '恋愛'],
    Severity: Minor
    Found in lib/bcdice/game_system/AlterRaise.rb and 2 other locations - About 25 mins to fix
    lib/bcdice/game_system/AlterRaise.rb on lines 114..124
    lib/bcdice/game_system/AlterRaise.rb on lines 203..213

    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 29.

    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

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

          def get_personality_table(roc)
            name = "性格傾向表"
            table = [
              [1, '挑戦'],
              [2, '調和'],
    Severity: Minor
    Found in lib/bcdice/game_system/AlterRaise.rb and 2 other locations - About 25 mins to fix
    lib/bcdice/game_system/AlterRaise.rb on lines 203..213
    lib/bcdice/game_system/AlterRaise.rb on lines 216..226

    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 29.

    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

    Further Reading

    There are no issues that match your filters.

    Category
    Status