bcdice/BCDice

View on GitHub

Showing 809 of 1,233 total issues

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

          Method get_damageEffect_table has 86 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def get_damageEffect_table(hitPart, damageStage)
                  damageInfos = [['L', '(LW)'],
                                 ['M', '(MW)'],
                                 ['H', '(HW)'],
                                 ['O', '(MO)']]
          Severity: Major
          Found in lib/bcdice/game_system/MetalHeadExtream.rb - About 3 hrs to fix

            Method check_action has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                  def check_action(command)
                    parser = Command::Parser.new("AB", round_type: RoundType::CEIL).has_prefix_number.enable_critical.enable_dollar.restrict_cmp_op_to(nil, :>=)
                    parsed = parser.parse(command)
                    return nil if parsed.nil?
            
            
            Severity: Minor
            Found in lib/bcdice/game_system/Ayabito.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 rating has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                  def rating(string) # レーティング表
                    debug("rating string", string)
                    command = rating_parser.parse(string)
            
                    unless command
            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 ability_roll has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                  def ability_roll(command)
                    m = /^AR([-+]\d+)?(>=(\d+))?([AD]?)/.match(command)
                    unless m
                      return nil
                    end
            Severity: Minor
            Found in lib/bcdice/game_system/DungeonsAndDragons5.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 getStepResult has 85 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def getStepResult(str)
                    return nil unless /(\d+)E(\d+)?(\+)?(\d+)?(d\d+)?/i =~ str
            
                    stepTotal = 0
                    @isFailed = true
            Severity: Major
            Found in lib/bcdice/game_system/EarthDawn.rb - About 3 hrs to fix

              File SwordWorld.rb has 307 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require "bcdice/base"
              require "bcdice/game_system/sword_world/rating_parser"
              
              module BCDice
                module GameSystem
              Severity: Minor
              Found in lib/bcdice/game_system/SwordWorld.rb - About 3 hrs to fix

                File AlchemiaStruggle.rb has 305 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require "bcdice/base"
                
                module BCDice
                  module GameSystem
                    class AlchemiaStruggle < Base
                Severity: Minor
                Found in lib/bcdice/game_system/AlchemiaStruggle.rb - About 3 hrs to fix

                  Method eval_game_system_specific_command has a Cognitive Complexity of 23 (exceeds 5 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: Minor
                  Found in lib/bcdice/game_system/WorldOfDarkness.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 use_edible_plant_chart has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def use_edible_plant_chart(command)
                          match_data = command.match(/EP([VA]?)(\d?)/)
                          chart_symbol = match_data[1] == '' ? 'V' : match_data[1]
                  
                          case chart_symbol
                  Severity: Minor
                  Found in lib/bcdice/game_system/Villaciel.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 roll_check has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def roll_check(command)
                          m = /^KS(?:\(([-+\d]+),([-+\d]+)?\)|(\d+))([AD]?)(?:>=([-+\d]+))?$/.match(command)
                          return nil unless m
                  
                          dice_size = m[1] ? Arithmetic.eval(m[1], @round_type) : Arithmetic.eval(m[3], @round_type).to_i
                  Severity: Minor
                  Found in lib/bcdice/game_system/KyokoShinshoku.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 fate_monster has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def fate_monster(_natural_result, order)
                          modified_result = []
                          if order.length > 9 && order[2] =~ /^\d+$/ && order[3] =~ /^\d+$/ && order[4] =~ /^\d+$/ && order[5] =~ /^\d+$/ && order[6] =~ /^\d+$/ && order[7] =~ /^\d+$/ && order[8] =~ /^\d+$/ && order[9] =~ /^\d+$/
                            if order[2].to_i > 0
                              modified_result.concat(@randomizer.roll_barabara(order[2].to_i, 2))
                  Severity: Minor
                  Found in lib/bcdice/game_system/HeroScale.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 getStepResult has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def getStepResult(str)
                          return nil unless /(\d+)E(\d+)?(\+)?(\d+)?(d\d+)?/i =~ str
                  
                          stepTotal = 0
                          @isFailed = true
                  Severity: Minor
                  Found in lib/bcdice/game_system/EarthDawn.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

                  Severity
                  Category
                  Status
                  Source
                  Language