bcdice/BCDice

View on GitHub

Showing 829 of 1,274 total issues

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

      def checkRoll(diceCount, modify, type, target)
        diceArray = @randomizer.roll_barabara(diceCount, 6).sort
        dice = diceArray.sum()
        diceText = diceArray.join(",")

Severity: Minor
Found in lib/bcdice/game_system/Postman.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 result_1d100 has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def result_1d100(total, _dice_total, cmp_op, target)
        return nil if target == '?'
        return nil unless cmp_op == :<=

        dice_value = total % 100 # 出目00は100ではなく00とする
Severity: Minor
Found in lib/bcdice/game_system/EclipsePhase.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 judgeDice has 52 lines of code (exceeds 25 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: Major
Found in lib/bcdice/game_system/KillDeathBusiness.rb - About 2 hrs to fix

    Method checkAnyCommand has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def checkAnyCommand(command)
            result =
              case command.upcase
              when 'RBT'
                getClassRoomBreakTable
    Severity: Major
    Found in lib/bcdice/game_system/Elysion.rb - About 2 hrs to fix

      File RyuTuber.rb has 253 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require "bcdice/dice_table/table"
      
      module BCDice
        module GameSystem
          class RyuTuber < Base
      Severity: Minor
      Found in lib/bcdice/game_system/RyuTuber.rb - About 2 hrs to fix

        File GundogRevised.rb has 251 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

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

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

                def eval_game_system_specific_command(command)
                  debug("eval_game_system_specific_command Begin")
          
                  parser = Command::Parser.new('VT', round_type: round_type)
                                          .enable_critical
          Severity: Minor
          Found in lib/bcdice/game_system/Ventangle.rb - About 2 hrs to fix

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

              Method check_strike_rank has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def check_strike_rank(strikeRank)
                      strikeRank = strikeRank.to_i
              
                      dice = ''
                      dice_add = ''
              Severity: Minor
              Found in lib/bcdice/game_system/Chill.rb - About 1 hr to fix

                Method check_action has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def check_action(command)
                        parser = Command::Parser.new(/!?VC/, round_type: RoundType::FLOOR)
                                                .enable_critical
                                                .enable_fumble
                                                .restrict_cmp_op_to(nil, :>=)
                Severity: Minor
                Found in lib/bcdice/game_system/VisionConnect.rb - About 1 hr to fix

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

                    Method proc_nrs has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def proc_nrs(dice_num, dificulty_s, type)
                            # 難易度も乱数表の番号も指定が無ければコマンドミス
                            dificulty_i = dificulty_s.nil? ? 0 : DIFFICULTY_SYMBOL_TO_INTEGER.fetch(dificulty_s)
                            if dificulty_i == 0 && type == 0
                              return nil
                    Severity: Minor
                    Found in lib/bcdice/game_system/NinjaSlayer2.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_2d6 has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def result_2d6(total, dice_total, _dice_list, cmp_op, target)
                            return Result.nothing if target == '?'
                            return nil unless [:>=, :>].include?(cmp_op)
                    
                            critical = false
                    Severity: Minor
                    Found in lib/bcdice/game_system/SharedFantasia.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_pools has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def get_dice_pools(m)
                            rage_dice_included_command = m[COMMAND_RAGE_DICE_INCLUDED_INDEX]
                            if rage_dice_included_command && rage_dice_included_command == "WAI"
                              # Rage Diceを内数処理するの場合
                              rage_dice_pool = m[RAGE_DICE_INCLUDED_INDEX].nil? ? -1 : m[RAGE_DICE_INCLUDED_INDEX].to_i
                    Severity: Minor
                    Found in lib/bcdice/game_system/WerewolfTheApocalypse5th.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_item_features_table has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def mk_item_features_table(num)
                            output = ""
                            dice = @randomizer.roll_sum(2, 6)
                    
                            if num <= 2
                    Severity: Minor
                    Found in lib/bcdice/game_system/meikyu_kingdom/item_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 getFullAutoResult has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def getFullAutoResult(command)
                              m = /^FAR\((-?\d+),(-?\d+),(-?\d+)(?:,(-?\d+)?)?(?:,(-?\w+)?)?(?:,(-?\d+)?)?\)$/i.match(command)
                              unless m
                                return nil
                              end
                    Severity: Minor
                    Found in lib/bcdice/game_system/cthulhu7th/full_auto.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_pools has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def get_dice_pools(m)
                            hunger_dice_included_command = m[COMMAND_HUNGER_DICE_INCLUDED_INDEX]
                            if hunger_dice_included_command && hunger_dice_included_command == "VMI"
                              # Hunger Diceを内数処理するの場合
                              hunger_dice_pool = m[HUNGER_DICE_INCLUDED_INDEX].nil? ? -1 : m[HUNGER_DICE_INCLUDED_INDEX].to_i
                    Severity: Minor
                    Found in lib/bcdice/game_system/VampireTheMasquerade5th.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_basic_battle has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def roll_basic_battle(command)
                            m = /^BB(M)?([-+][-+\d]+)?(>([-+\d]+))?/.match(command)
                            return nil unless m
                    
                            mob = m[1]
                    Severity: Minor
                    Found in lib/bcdice/game_system/GundamSentinel.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 check_action has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def check_action(command)
                            parser = Command::Parser.new(/!?VC/, round_type: RoundType::FLOOR)
                                                    .enable_critical
                                                    .enable_fumble
                                                    .restrict_cmp_op_to(nil, :>=)
                    Severity: Minor
                    Found in lib/bcdice/game_system/VisionConnect.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 skill_roll has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def skill_roll(command)
                            m = /^CC([-+]?\d+)?(?:<=(\d+)([RHEC])?)?$/.match(command)
                            unless m
                              return nil
                            end
                    Severity: Minor
                    Found in lib/bcdice/game_system/Cthulhu7th.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