bcdice/BCDice

View on GitHub

Showing 837 of 1,278 total issues

Method getTrapTable has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def getTrapTable(diff)
        case diff
        when "E" # 初級
          dif = "初級"
          d = 0
Severity: Minor
Found in lib/bcdice/game_system/GurpsFW.rb - About 1 hr to fix

    Method result_1d20 has 36 lines of code (exceeds 25 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 1 hr to fix

      Method mk_new_name_table has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def mk_new_name_table
              nick_table = "1"
              name_table = "1"
              # 新名前表
              nick_n = @randomizer.roll_once(6)
      Severity: Minor
      Found in lib/bcdice/game_system/meikyu_kingdom_basic/name_table.rb - About 1 hr to fix

        Method torg_eternity_dice has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def torg_eternity_dice(check_pos, check_mishap)
                isSkilledCritical = true
                isCritical = true
                skilled = 0
                unskilled = 0
        Severity: Minor
        Found in lib/bcdice/game_system/TorgEternity.rb - About 1 hr to fix

          Method roll_f has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def roll_f(command)
                  parser = Command::Parser.new(/F(\d+)(\+\d+)*(-\d+)*/, round_type: RoundType::CEIL)
                                          .disable_modifier
                                          .enable_critical
                  cmd = parser.parse(command)
          Severity: Minor
          Found in lib/bcdice/game_system/ToshiakiHolyGrailWar.rb - About 1 hr to fix

            Method roll_general_skill has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def roll_general_skill(command)
                    m = /^GS([-+][-+\d]+)?(>([-+\d]+))?/.match(command)
                    return nil unless m
            
                    modify = ArithmeticEvaluator.eval(m[1])
            Severity: Minor
            Found in lib/bcdice/game_system/GundamSentinel.rb - About 1 hr to fix

              Method roll_cf has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def roll_cf(command)
                      # マイナス補正にダイスロールを用いることはシステム上ありえないため、正規表現ではじく
                      m = /^(H)?CF([LG])?(T)?((?:[+-]*\d+|\+?\d+D\d+)(?:[+-]+\d+|\++\d+D\d+)*)$/.match(command)
                      return nil unless m
              
              
              Severity: Minor
              Found in lib/bcdice/game_system/Yggdrasill.rb - About 1 hr to fix

                Method result has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                        def result(value_groups)
                          r = Result.new
                
                          r.fumble = value_groups[0].values.all?(1)
                
                
                Severity: Minor
                Found in lib/bcdice/game_system/DoubleCross.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 result_1d20 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def result_1d20(total, _dice_total, cmp_op, target)
                        return Result.nothing if target == '?'
                        return nil unless cmp_op == :<=
                
                        if total > target
                Severity: Minor
                Found in lib/bcdice/game_system/InfiniteFantasia.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 getCheckResultText has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def getCheckResultText(total, diff, fumbleable = false)
                        if total <= diff
                          return "대성공" if total == 1
                          return "대단한 성공" if total <= (diff / 5)
                          return "어려운 성공" if total <= (diff / 2)
                Severity: Minor
                Found in lib/bcdice/game_system/Cthulhu7th_Korean.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 roll_nr has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def roll_nr(command)
                        m = /^(\d+)?NR(6|8|10|12)$/.match(command)
                        return nil unless m
                
                        times = m[1]&.to_i || 1
                Severity: Minor
                Found in lib/bcdice/game_system/NRR.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 command_sn has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def command_sn(command)
                        debug("SN", command)
                        cmd = Command::Parser.new(/[1-9]?SN(\d{0,2})/, round_type: round_type)
                                             .restrict_cmp_op_to(nil)
                                             .enable_fumble.parse(command)
                Severity: Minor
                Found in lib/bcdice/game_system/SkynautsBouken.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 checkRoll has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def checkRoll(string)
                        debug("checkRoll begin string", string)
                
                        m = /^(\d+)R>=(\d+)(\[(\d+)?(,|,\d+)?(,\d+(S)?)?\])?$/i.match(string)
                        return nil unless m
                Severity: Minor
                Found in lib/bcdice/game_system/Satasupe.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 get_dice has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def get_dice(mod, abl, skl)
                        total = 0
                        crit = 0
                        fumble = 0
                        dice_c = 3 + mod.abs
                Severity: Minor
                Found in lib/bcdice/game_system/DarkBlaze.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 roll_d has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def roll_d(command, times, sides, target)
                        dice_list = @randomizer.roll_barabara(times, sides).sort
                        total = dice_list.sum
                        success = total <= target
                
                
                Severity: Minor
                Found in lib/bcdice/game_system/ArknightsFan.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 roll_kansoku has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def roll_kansoku(command)
                        m = /^KR(?:(\d+)|\((\d),(\d)\))$/.match(command)
                        return nil unless m
                
                        dice_size = m[1]&.to_i || m[2].to_i
                Severity: Minor
                Found in lib/bcdice/game_system/KyokoShinshoku.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 mk_new_name_table has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def mk_new_name_table
                        nick_table = "1"
                        name_table = "1"
                        # 新名前表
                        nick_n = @randomizer.roll_once(6)
                Severity: Minor
                Found in lib/bcdice/game_system/meikyu_kingdom_basic/name_table.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 roll_burst has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def roll_burst(command)
                        m = /^(\d{2})C$/.match(command)
                        unless m
                          return nil
                        end
                Severity: Minor
                Found in lib/bcdice/game_system/BeginningIdol.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 die_choice has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def die_choice(dice_list, favoured_state_value)
                        if favoured_state_value == FavouredState::ILLFAVOURED
                          if dice_list.count(SAURONS_EYE_NUMBER) >= 1
                            return SAURONS_EYE_NUMBER
                          else
                Severity: Minor
                Found in lib/bcdice/game_system/TheOneRing2nd.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 getUpRollDiceCommandResult has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def getUpRollDiceCommandResult(command)
                        debug("Torg Eternity Dice Roll ( UP ) Command ? ", command)
                        m = /^UP(\d*)$/i.match(command)
                        unless m
                          return nil
                Severity: Minor
                Found in lib/bcdice/game_system/TorgEternity.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

                Severity
                Category
                Status
                Source
                Language