bcdice/BCDice

View on GitHub

Showing 837 of 1,278 total issues

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

          def eval(game_system, randomizer)
            dice = @notation.to_dice(game_system.round_type)
            unless dice.valid?
              return nil
            end
Severity: Minor
Found in lib/bcdice/common_command/tally_dice/node.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 getResultText has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def getResultText(rating_total, command, diceResults, diceResultTotals,
                        rateResults, dice_total, round)
Severity: Major
Found in lib/bcdice/game_system/SwordWorld.rb - About 50 mins to fix

    Method checkRoll has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def checkRoll(diceCount, modify, critical, fumble, target, isStormy, optionalText)
    Severity: Major
    Found in lib/bcdice/game_system/BadLife.rb - About 50 mins to fix

      Method get_rg_roll_result has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def get_rg_roll_result(result_header_text, difficulty, feat_die_number, piercing_blows_number, total_dice_number, success_count, opts)
      Severity: Major
      Found in lib/bcdice/game_system/TheOneRing2nd.rb - About 50 mins to fix

        Method checkRoll has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def checkRoll(rollText, target, modify, accidentValue, advancedRoll, luckPoint, isMuse)
        Severity: Major
        Found in lib/bcdice/game_system/MetalHeadExtream.rb - About 50 mins to fix

          Method roll_sp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def roll_sp(command)
                  m = /^SP(\d+)(?:>=(\d+))?$/i.match(command)
                  unless m
                    return nil
                  end
          Severity: Minor
          Found in lib/bcdice/game_system/SteamPunkers.rb - About 45 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 eval_game_system_specific_command has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def eval_game_system_specific_command(command)
                  string = command.upcase
                  string = replace_text(string)
          
                  if (result = torg_check(string))
          Severity: Minor
          Found in lib/bcdice/game_system/Torg.rb - About 45 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 check_roll has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def check_roll(command, base, target, critical_target, diff, modifier)
          Severity: Minor
          Found in lib/bcdice/game_system/CodeLayerd.rb - About 45 mins to fix

            Method getCombineRoll has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def getCombineRoll(command)
                    m = /^CBR(B)?\((\d+),(\d+)\)$/i.match(command)
                    unless m
                      return nil
                    end
            Severity: Minor
            Found in lib/bcdice/game_system/Cthulhu.rb - About 45 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 rollFullAuto has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def rollFullAuto(bullet_count, diff, broken_number, dice_num)
                    output = ""
                    loopCount = 0
            
                    counts = {
            Severity: Minor
            Found in lib/bcdice/game_system/Cthulhu7th_Korean.rb - About 45 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 roll has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    def roll(randomizer)
                      dice = randomizer.roll_once(@items.length)
                      chosen = @items[dice - 1]
            
                      fumble = chosen == FUMBLE
            Severity: Minor
            Found in lib/bcdice/game_system/KamitsubakiCityUnderConstructionNarrative.rb - About 45 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 eval_game_system_specific_command has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def eval_game_system_specific_command(command)
                    # AA/ALコマンド:調査判定, 成功判定
                    if command =~ /(\d+)?A(A|L)(\d+)?((x|\*)(\d+)(\+(\d+))?)?(C(\d+))?$/i
                      diceCount = (Regexp.last_match(1) || 2).to_i
                      target = (Regexp.last_match(3) || 6).to_i
            Severity: Minor
            Found in lib/bcdice/game_system/Airgetlamh.rb - About 45 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 check_action has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def check_action(match_data)
                    dice_cnt = Arithmetic.eval(match_data[1], RoundType::FLOOR)
                    target = Arithmetic.eval(match_data[2], RoundType::FLOOR)
                    debug("dice_cnt", dice_cnt)
                    debug("target", target)
            Severity: Minor
            Found in lib/bcdice/game_system/AnimaAnimus.rb - About 45 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 eval_game_system_specific_command has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def eval_game_system_specific_command(command)
                    unless parse(command)
                      return nil
                    end
            
            
            Severity: Minor
            Found in lib/bcdice/game_system/BBN.rb - About 45 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 getDamages has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def getDamages(damageFunc, partTable, damages)
                    resultText = ''
                    damage, dice, isLrm = damageFunc.call()
            
                    damagePartCount = 1
            Severity: Minor
            Found in lib/bcdice/game_system/BattleTech.rb - About 45 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 getTotalDamage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def getTotalDamage(damages)
                    parts = ['頭',
                             '胴中央',
                             '右胴',
                             '左胴',
            Severity: Minor
            Found in lib/bcdice/game_system/BattleTech.rb - About 45 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 result_1d100 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def result_1d100(total, _dice_total, cmp_op, target)
                    return nil if target == '?'
                    return nil if cmp_op != :<=
            
                    if total >= 100
            Severity: Minor
            Found in lib/bcdice/game_system/Chill.rb - About 45 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 result_text has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def result_text(total, cmp_op, target)
                    return nil unless cmp_op == :>=
            
                    if target != "?"
                      return total >= target ? "成功" : "失敗"
            Severity: Minor
            Found in lib/bcdice/game_system/NightmareHunterDeep.rb - About 45 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 get_judge_result has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def get_judge_result(command)
                    return nil unless (m = /^2D6<=(\d)$/i.match(command) || /^SN(\d*)$/i.match(command))
            
                    debug("====get_judge_result====")
            
            
            Severity: Minor
            Found in lib/bcdice/game_system/Skynauts.rb - About 45 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 eval_game_system_specific_command has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def eval_game_system_specific_command(command)
                    debug('eval_game_system_specific_command begin')
            
                    unless command =~ /^R(\d+)(,(\d+))?([+\-\d]+)?(>=(\d+))?/
                      debug('unmatched!')
            Severity: Minor
            Found in lib/bcdice/game_system/Ryutama.rb - About 45 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