bcdice/BCDice

View on GitHub

Showing 837 of 1,278 total issues

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

      def getStepResultInfos(str)
        steps = []
        calcs = []
        totals = []
        target = 0
Severity: Minor
Found in lib/bcdice/game_system/EarthDawn4.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_f has a Cognitive Complexity of 12 (exceeds 5 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

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_ChineseTraditional.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 resolute_action has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def resolute_action(command)
        m = /^TC([+\d]*)(>=(\d+))?/.match(command)
        return nil unless m

        bonus =
Severity: Minor
Found in lib/bcdice/game_system/TrailOfCthulhu.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_roll has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def check_roll(command, base, target, critical_target, diff, modifier)
        if base <= 0 # クリティカルしない1D
          critical_target = 0
          base = 1
        end
Severity: Minor
Found in lib/bcdice/game_system/CodeLayerd.rb - About 1 hr to fix

    Method proc_dice_2nd has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def proc_dice_2nd(match)
            output_text = ''
            total_success_num = 0
    
            difficulty = DIFFICULTY_SYMBOL_TO_INTEGER.fetch(match[1])
    Severity: Minor
    Found in lib/bcdice/game_system/NinjaSlayer2.rb - About 1 hr to fix

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

            def checkRoll(command)
              debug("checkRoll begin command", command)
      
              result = Result.new
              result.text = ''
      Severity: Minor
      Found in lib/bcdice/game_system/StrangerOfSwordCity.rb - About 1 hr to fix

        Method get_roll_result has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def get_roll_result(result_text, success_dice, ten_dice, _rage_ten_dice, brutal_outcome, difficulty)
                is_critical = ten_dice >= 2
        
                if brutal_outcome > 0 && difficulty != 0
                  success_dice += 4
        Severity: Minor
        Found in lib/bcdice/game_system/WerewolfTheApocalypse5th.rb - About 1 hr to fix

          Method execute has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def execute(randomizer)
                    if @critical_value < 3
                      return translate("SwordWorld2_0.transcendent_critical_too_small", expression: @expression)
                    end
          
          
          Severity: Minor
          Found in lib/bcdice/game_system/sword_world/transcendent_test.rb - About 1 hr to fix

            Method translate_tables has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def translate_tables(locale)
                      {
                        "ECT" => DiceTable::Table.from_i18n("Amadeus.table.ECT", locale),
                        "BST" => DiceTable::Table.from_i18n("Amadeus.table.BST", locale),
                        "RT" => DiceTable::Table.from_i18n("Amadeus.table.RT", locale),
            Severity: Minor
            Found in lib/bcdice/game_system/Amadeus.rb - About 1 hr to fix

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

                    def checkRoll(rapid, target, damage, isCritical, criticalNumber)
                      totalSuccessCount = 0
                      totalCriticalCount = 0
                      text = ""
              
              
              Severity: Minor
              Found in lib/bcdice/game_system/Alsetto.rb - About 1 hr to fix

                Method resolute_action has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def resolute_action(command)
                        parser = Command::Parser.new("LM", round_type: @round_type)
                                                .has_suffix_number
                                                .restrict_cmp_op_to(:>=)
                        parsed = parser.parse(command)
                Severity: Minor
                Found in lib/bcdice/game_system/Liminal.rb - About 1 hr to fix

                  Method select_origin has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def select_origin(command)
                          order = command.split(",")
                  
                          case order[0]
                          when "5HS4"
                  Severity: Minor
                  Found in lib/bcdice/game_system/HeroScale.rb - About 1 hr to fix

                    Method get_urge has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def get_urge(string)
                            m = /([NAMUC])?URGE\s*(\d+)/i.match(string)
                            unless m
                              return '1'
                            end
                    Severity: Minor
                    Found in lib/bcdice/game_system/DemonParasite.rb - About 1 hr to fix

                      Method check_roll has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def check_roll(command)
                              m = /^(\d+)D6([+\-\d]*)>=(\?|\d+)(\[(\d+)?(,(\d+))?\])?$/i.match(command)
                              unless m
                                return nil
                              end
                      Severity: Minor
                      Found in lib/bcdice/game_system/MonotoneMuseum.rb - About 1 hr to fix

                        Method proc_nrs has 33 lines of code (exceeds 25 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

                          Method resolute_initiative has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                def resolute_initiative(command)
                                  parser = Command::Parser.new("LI", round_type: @round_type)
                                                          .has_suffix_number
                                                          .restrict_cmp_op_to(:>=)
                                  parsed = parser.parse(command)
                          Severity: Minor
                          Found in lib/bcdice/game_system/Liminal.rb - About 1 hr to fix

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

                              Method rollFullAuto has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      def rollFullAuto(bullet_count, diff, broken_number, dice_num, stop_count, bullet_set_count_cap)
                                        output = ""
                                        loopCount = 0
                              
                                        counts = {
                              Severity: Minor
                              Found in lib/bcdice/game_system/cthulhu7th/full_auto.rb - About 1 hr to fix

                                Method getStepResult has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                      def getStepResult(str)
                                        return nil unless /^(\d+)E(\d+)?(\+(\d*)D(\d+))?(\+\d)?/i =~ str
                                
                                        stepTotal = 0
                                        @isFailed = true
                                Severity: Minor
                                Found in lib/bcdice/game_system/EarthDawn3.rb - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language