bcdice/BCDice

View on GitHub

Showing 837 of 1,278 total issues

Method checkRoll has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def checkRoll(diceCount, isActive, modify, target)
        dice_list = @randomizer.roll_barabara(diceCount, 6)
        dice = dice_list.sum()
        diceText = dice_list.join(",")

Severity: Minor
Found in lib/bcdice/game_system/DarkSouls.rb - About 1 hr to fix

    Method getDiceType has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def getDiceType(dice1, dice2)
            debug('getDiceType begin')
    
            if dice2 != 0
              if isValidDiceOne(dice1)
    Severity: Minor
    Found in lib/bcdice/game_system/Ryutama.rb - About 1 hr to fix

      Method r_roll has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def r_roll(string)
              parser = Command::Parser.new(/\d+R6/, round_type: round_type)
                                      .restrict_cmp_op_to(nil, :>=)
                                      .enable_critical
                                      .enable_fumble
      Severity: Minor
      Found in lib/bcdice/game_system/OracleEngine.rb - About 1 hr to fix

        Method result_1d100 has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def result_1d100(total, _dice_total, cmp_op, target)
                return Result.nothing if target == '?'
                return nil unless cmp_op == :<=
        
                t10 = total / 10
        Severity: Minor
        Found in lib/bcdice/game_system/Warhammer4.rb - About 1 hr to fix

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

                def eval_game_system_specific_command(command)
                  output = '1'
                  type = ""
                  total_n = ""
          
          
          Severity: Minor
          Found in lib/bcdice/game_system/KanColle.rb - About 1 hr to fix

            Method get_strategyEvent_chart has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def get_strategyEvent_chart
                    name = 'ストラテジーイベントチャート'
                    table = [
                      [50, '特に何事もなかった。'],
                      [53, 'スコール。種別:レーザーを装備している部隊の戦力はこのターン半減する。この効果は重複しない。'],
            Severity: Minor
            Found in lib/bcdice/game_system/MetalHeadExtream.rb - About 1 hr to fix

              Method getBulletResults has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def getBulletResults(bullet_count, hit_type, diff, bullet_set_count_cap)
                        bullet_set_count = getSetOfBullet(diff, bullet_set_count_cap)
                        hit_bullet_count_base = getHitBulletCountBase(diff, bullet_set_count)
                        impale_bullet_count_base = (bullet_set_count / 2.to_f)
              
              
              Severity: Minor
              Found in lib/bcdice/game_system/cthulhu7th/full_auto.rb - About 1 hr to fix

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

                      def eval_game_system_specific_command(command)
                        m = /\A(\d+)?(((VMF)(\d+)(\+(\d+))?)|((VMI)(\d+)(H(\d+))?))$/.match(command)
                        unless m
                          return ''
                        end
                Severity: Minor
                Found in lib/bcdice/game_system/VampireTheMasquerade5th.rb - About 1 hr to fix

                  Method getStepInfo has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def getStepInfo(step)
                          baseStepTable = getBaseStepTable
                          baseMaxStep = baseStepTable.last.first
                  
                          if step <= baseMaxStep
                  Severity: Minor
                  Found in lib/bcdice/game_system/EarthDawn3.rb - About 1 hr to fix

                    Method result_ladder has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def result_ladder(total)
                            ladder =
                              case total.clamp(-2, 8)
                              when 8
                                "Legendary"
                    Severity: Minor
                    Found in lib/bcdice/game_system/FateCoreSystem.rb - About 1 hr to fix

                      Method check_result has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def check_result(total, rand_results, cmp_op, target)
                            ret = check_result_legacy(total, rand_results, cmp_op, target)
                            return ret if ret
                      
                            sides_list = rand_results.map(&:sides)
                      Severity: Minor
                      Found in lib/bcdice/base.rb - About 1 hr to fix

                        Method roll_judge has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def roll_judge(modifier_expression, border_expression)
                                modifier = modifier_expression ? Arithmetic.eval(modifier_expression, RoundType::FLOOR) : nil
                                border = border_expression.to_i
                        
                                command_text = make_command_text(modifier, border)
                        Severity: Minor
                        Found in lib/bcdice/game_system/Aoharubaan.rb - About 55 mins 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 torg_dice has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def torg_dice
                                isSkilledCritical = true
                                isCritical = true
                                skilled = 0
                                unskilled = 0
                        Severity: Minor
                        Found in lib/bcdice/game_system/Torg.rb - About 55 mins 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 getFullAutoResult has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def getFullAutoResult(command)
                                return nil unless /^FAR\((-?\d+)(,(-?\d+))(,(-?\d+))(,(-?\d+))?\)/i =~ command
                        
                                bullet_count = Regexp.last_match(1).to_i
                                diff = Regexp.last_match(3).to_i
                        Severity: Minor
                        Found in lib/bcdice/game_system/Cthulhu7th_Korean.rb - About 55 mins 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 additional_roll has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def additional_roll(additional_dice, total)
                                sequence = []
                                reroll_count = 0
                        
                                # 追加クリティカルは無限ループしうるので、10回に制限
                        Severity: Minor
                        Found in lib/bcdice/game_system/BBN.rb - About 55 mins 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 getMusicalInstrumentTypeDiceCommandResult has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def getMusicalInstrumentTypeDiceCommandResult(command)
                                return nil unless command =~ /MII(\d?)/
                        
                                is_roll = !(Regexp.last_match(1) && Regexp.last_match(1) != '')
                                type = is_roll ? @randomizer.roll_once(6) : Regexp.last_match(1).to_i
                        Severity: Minor
                        Found in lib/bcdice/game_system/LogHorizon.rb - About 55 mins 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 cp_roll_result has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def cp_roll_result(command)
                                parser = Command::Parser.new('CP', round_type: RoundType::FLOOR)
                                                        .enable_suffix_number
                                                        .restrict_cmp_op_to(nil, :>)
                                parsed = parser.parse(command)
                        Severity: Minor
                        Found in lib/bcdice/game_system/CyberpunkRed.rb - About 55 mins 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 torg_check has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def torg_check(string)
                                unless /(^|\s)S?(1R20([+-]\d+)*)(\s|$)/i =~ string
                                  return nil
                                end
                        
                        
                        Severity: Minor
                        Found in lib/bcdice/game_system/Torg.rb - About 55 mins 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 getHitResult has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def getHitResult(count, damageFunc, tail)
                                m = /\A([LCR][LU]?)?(\+\d+)?>=(\d+)/.match(tail)
                                return nil unless m
                        
                                side = m[1] || 'C'
                        Severity: Minor
                        Found in lib/bcdice/game_system/BattleTech.rb - About 55 mins 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 to_s has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def to_s(suffix_position = :after_command)
                                c = @critical ? "@#{@critical}" : nil
                                f = @fumble ? "##{@fumble}" : nil
                                d = @dollar ? "$#{@dollar}" : nil
                                m = Format.modifier(@modify_number)
                        Severity: Minor
                        Found in lib/bcdice/command/parsed.rb - About 55 mins 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