bcdice/BCDice

View on GitHub

Showing 837 of 1,278 total issues

Method roll_amadeus has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def roll_amadeus(command)
        m = /^R([A-DS])([+\-\d]*)(@(\d))?((>=?)([+\-\d]*))?(@(\d))?$/i.match(command)
        unless m
          return nil
        end
Severity: Major
Found in lib/bcdice/game_system/Amadeus.rb - About 2 hrs to fix

    Method ability_roll has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def ability_roll(command)
            m = /^AR([-+]\d+)?(>=(\d+))?([AD]?)/.match(command)
            unless m
              return nil
            end
    Severity: Major
    Found in lib/bcdice/game_system/DungeonsAndDragons5.rb - About 2 hrs to fix

      Method check_roll_loop has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

            def check_roll_loop(roll_times, min_suc, target, critical, fumble, is_critical_stop)
              dice_str = ''
              is_fumble = false
              is_critical = false
              total_suc = 0
      Severity: Minor
      Found in lib/bcdice/game_system/Satasupe.rb - About 2 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 roll_judge has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

            def roll_judge(command)
              m = /^TN(6|10)([CSBYA]*)$/.match(command)
              unless m
                return nil
              end
      Severity: Minor
      Found in lib/bcdice/game_system/TensaiGunshiNiNaro.rb - About 2 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 resolute_attacking has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

            def resolute_attacking(command)
              m = /^([-+]\d+)?AA<=(\d+)$/.match(command)
              return nil unless m
      
              num_bonus = m[1].to_i
      Severity: Minor
      Found in lib/bcdice/game_system/AniMalus.rb - About 2 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 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def eval_game_system_specific_command(command)
              difficulty = 6
              auto_success = 0
              enabled_reroll = false
              enabled_reroll_with_botch = false
      Severity: Major
      Found in lib/bcdice/game_system/WorldOfDarkness.rb - About 2 hrs to fix

        File RuinBreakers.rb has 258 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'bcdice/arithmetic_evaluator'
        require 'bcdice/dice_table/table'
        require 'bcdice/dice_table/range_table'
        
        module BCDice
        Severity: Minor
        Found in lib/bcdice/game_system/RuinBreakers.rb - About 2 hrs to fix

          Class Cthulhu7th_Korean has 21 methods (exceeds 20 allowed). Consider refactoring.
          Open

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

            Class Cthulhu7th_ChineseTraditional has 21 methods (exceeds 20 allowed). Consider refactoring.
            Open

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

              Method getStructureEncounter has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def getStructureEncounter(number)
                      debug("getStructureEncounter number", number)
              
                      tables = [[1, ['船から降りてきた', '魚を売っている', '仕事で忙しそうな', '異国から来た', 'おもしろおかしい', '汗水流している']],
                                [2, ['おかしな格好をした', '歌を歌っている', 'ステキな笑顔をした', '日なたぼっこをしている', '悩んでいる', '旅をしている']],
              Severity: Major
              Found in lib/bcdice/game_system/WitchQuest.rb - About 2 hrs to fix

                Method getUpRollDiceCommandResult has 54 lines of code (exceeds 25 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: Major
                Found in lib/bcdice/game_system/TorgEternity.rb - About 2 hrs to fix

                  Method roll_judge has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def roll_judge(command)
                          m = /^TN(6|10)([CSBYA]*)$/.match(command)
                          unless m
                            return nil
                          end
                  Severity: Major
                  Found in lib/bcdice/game_system/TensaiGunshiNiNaro.rb - About 2 hrs to fix

                    Method roll_basic_battle has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def roll_basic_battle(command)
                            m = /^BB(M)?([-+][-+\d]+)?(>([-+\d]+))?/.match(command)
                            return nil unless m
                    
                            mob = m[1]
                    Severity: Major
                    Found in lib/bcdice/game_system/GundamSentinel.rb - About 2 hrs to fix

                      File SajinsenkiAGuS2E.rb has 256 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require 'bcdice/game_system/SajinsenkiAGuS'
                      
                      module BCDice
                        module GameSystem
                          class SajinsenkiAGuS2E < SajinsenkiAGuS
                      Severity: Minor
                      Found in lib/bcdice/game_system/SajinsenkiAGuS2E.rb - About 2 hrs to fix

                        Method getResultText has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              def getResultText(rating_total, command, diceResults, diceResultTotals,
                                                rateResults, dice_total, round)
                                sequence = []
                        
                                sequence.push("2D:[#{diceResults.join(' ')}]=#{diceResultTotals.join(',')}")
                        Severity: Major
                        Found in lib/bcdice/game_system/SwordWorld.rb - About 2 hrs to fix

                          Method get_horidasibukuro_table has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                def get_horidasibukuro_table(dice)
                                  output = '1'
                          
                                  material_kind = [ # 2D6
                                    "蟲甲",     # 5
                          Severity: Major
                          Found in lib/bcdice/game_system/DarkBlaze.rb - About 2 hrs to fix

                            Method eval_game_system_specific_command has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  def eval_game_system_specific_command(command)
                                    text =
                                      case command.upcase
                            
                                      when %r{([AS])R(\d+)(([*/]\d+)*)?(((@|A|L)\d+)*)(!M)?$}i
                            Severity: Major
                            Found in lib/bcdice/game_system/MetalHeadExtream.rb - About 2 hrs to fix

                              Method judgeDice has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def judgeDice(command)
                                      fumble_match = /,(\d+)$/.match(command)
                              
                                      parser = Command::Parser.new(/JD\d+/, round_type: round_type)
                                                              .enable_critical
                              Severity: Minor
                              Found in lib/bcdice/game_system/KillDeathBusiness.rb - About 2 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 roll_barna_kronika has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def roll_barna_kronika(dice_n, criticalCallDice)
                                      dice_n = dice_n.to_i
                              
                                      output = ''
                                      suc = 0
                              Severity: Minor
                              Found in lib/bcdice/game_system/BarnaKronika.rb - About 2 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 roll_attack has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def roll_attack(power_expression, dice_count_expression, border_expression, modification_operator, modification_expression)
                                      power = Arithmetic.eval(power_expression, RoundType::CEIL)
                                      dice_count = Arithmetic.eval(dice_count_expression, RoundType::CEIL)
                                      border = Arithmetic.eval(border_expression, RoundType::CEIL)
                                      modification_value = modification_expression.nil? ? nil : Arithmetic.eval(modification_expression, RoundType::CEIL)
                              Severity: Minor
                              Found in lib/bcdice/game_system/Irisbane.rb - About 2 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

                              Severity
                              Category
                              Status
                              Source
                              Language