bcdice/BCDice

View on GitHub

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 = [
Severity: Major
Found in lib/bcdice/game_system/GurpsFW.rb - About 4 hrs to fix

    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',
    Severity: Major
    Found in lib/bcdice/game_system/SwordWorld.rb - About 4 hrs to fix

      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()
      Severity: Minor
      Found in lib/bcdice/game_system/meikyu_kingdom/item_table.rb - About 4 hrs to fix

        File StellarLife.rb has 332 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module BCDice
          module GameSystem
            class StellarLife < Base
              # ゲームシステムの識別子
              ID = 'StellarLife'
        Severity: Minor
        Found in lib/bcdice/game_system/StellarLife.rb - About 4 hrs to fix

          Method getDamageTypeAndTable has 98 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def getDamageTypeAndTable(head)
                  case head
                  when "S"
                    type = '射撃'
                    # 射撃ダメージペナルティー表
          Severity: Major
          Found in lib/bcdice/game_system/GundogRevised.rb - About 3 hrs to fix

            Method getDamageTypeAndTable has 98 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def getDamageTypeAndTable(head)
                    case head
                    when "S"
                      type = '射撃'
                      # 射撃ダメージペナルティー表
            Severity: Major
            Found in lib/bcdice/game_system/GundogZero.rb - About 3 hrs to fix

              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
              Severity: Minor
              Found in lib/bcdice/game_system/WerewolfTheApocalypse5th.rb - About 3 hrs 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 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
              
              
              Severity: Major
              Found in lib/bcdice/game_system/TunnelsAndTrolls.rb - About 3 hrs to fix

                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, '頭部',
                Severity: Major
                Found in lib/bcdice/game_system/Warhammer.rb - About 3 hrs to fix

                  File GURPS.rb has 321 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  module BCDice
                    module GameSystem
                      class GURPS < Base
                        # ゲームシステムの識別子
                        ID = 'GURPS'
                  Severity: Minor
                  Found in lib/bcdice/game_system/GURPS.rb - About 3 hrs to fix

                    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
                    Severity: Minor
                    Found in lib/bcdice/game_system/TrinitySeven.rb - About 3 hrs to fix

                      File GundamSentinel.rb has 317 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      module BCDice
                        module GameSystem
                          class GundamSentinel < Base
                            # ゲームシステムの識別子
                            ID = 'GundamSentinel'
                      Severity: Minor
                      Found in lib/bcdice/game_system/GundamSentinel.rb - About 3 hrs to fix

                        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(',')}")
                        Severity: Minor
                        Found in lib/bcdice/game_system/SwordWorld.rb - About 3 hrs 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 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 == :<=
                        
                                # 技能値の修正を計算する
                        Severity: Minor
                        Found in lib/bcdice/game_system/PhantasmAdventure.rb - About 3 hrs 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 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)
                        Severity: Minor
                        Found in lib/bcdice/game_system/BadLife.rb - About 3 hrs 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 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 = []
                        Severity: Minor
                        Found in lib/bcdice/game_system/BlindMythos.rb - About 3 hrs 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

                        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)
                        Severity: Minor
                        Found in lib/bcdice/game_system/filled_with/enemy_data_tables.rb - About 3 hrs to fix

                          Class ShinkuuGakuen has 29 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                              class ShinkuuGakuen < Base
                                # ゲームシステムの識別子
                                ID = 'ShinkuuGakuen'
                          
                                # ゲームシステム名
                          Severity: Minor
                          Found in lib/bcdice/game_system/ShinkuuGakuen.rb - About 3 hrs to fix

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

                                  def getDamageTypeAndTable(head)
                                    case head
                                    when "S"
                                      type = '射撃'
                                      # 射撃ダメージペナルティー表
                            Severity: Major
                            Found in lib/bcdice/game_system/GundogZero.rb and 1 other location - About 3 hrs to fix
                            lib/bcdice/game_system/GundogRevised.rb on lines 103..209

                            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

                            Further Reading

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

                                  def getDamageTypeAndTable(head)
                                    case head
                                    when "S"
                                      type = '射撃'
                                      # 射撃ダメージペナルティー表
                            Severity: Major
                            Found in lib/bcdice/game_system/GundogRevised.rb and 1 other location - About 3 hrs to fix
                            lib/bcdice/game_system/GundogZero.rb on lines 69..175

                            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

                            Further Reading

                            Severity
                            Category
                            Status
                            Source
                            Language