bcdice/BCDice

View on GitHub

Showing 829 of 1,274 total issues

Method roll has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def roll(randomizer)
          dice = randomizer.roll_once(6)
          chosen = TABLE[dice - 1]

          Result.new.tap do |r|
Severity: Minor
Found in lib/bcdice/game_system/KamitsubakiCityUnderConstructionNarrative.rb - About 35 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_2d6 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def result_2d6(total, dice_total, _dice_list, cmp_op, target)
        return nil unless cmp_op == :>=

        if dice_total <= 2
          Result.fumble("絶対失敗")
Severity: Minor
Found in lib/bcdice/game_system/MeikyuDays.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def eval_game_system_specific_command(string)
        cmd = parse_nw(string) || parse_2r6(string)
        unless cmd
          return nil
        end
Severity: Minor
Found in lib/bcdice/game_system/NightWizard.rb - About 35 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 consciousness_roll has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def consciousness_roll(damage)
        unless (1..6).include?(damage)
          return nil
        end

Severity: Minor
Found in lib/bcdice/game_system/BattleTech.rb - About 35 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def check_roll(dice_count, count_no)
        dice_array = @randomizer.roll_barabara(dice_count, 10).sort
        dice_text = dice_array.join(',')

        result_array = []
Severity: Minor
Found in lib/bcdice/game_system/OrgaRain.rb - About 35 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_2d6 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def result_2d6(total, dice_total, _dice_list, cmp_op, target)
        return nil unless cmp_op == :<=

        if dice_total <= 2
          Result.critical("クリティカル")
Severity: Minor
Found in lib/bcdice/game_system/WARPS.rb - About 35 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 getCombineRoll has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def getCombineRoll(command)
        return nil unless /CBR\((\d+),(\d+)\)/i =~ command

        diff_1 = Regexp.last_match(1).to_i
        diff_2 = Regexp.last_match(2).to_i
Severity: Minor
Found in lib/bcdice/game_system/Cthulhu7th_Korean.rb - About 35 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 checkRoll has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def checkRoll(diceCount, target, damage)
        target = 1 if target < 1
        target = 10 if target > 10

        diceArray = @randomizer.roll_barabara(diceCount, 10).sort
Severity: Minor
Found in lib/bcdice/game_system/Strave.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def eval_game_system_specific_command(command) # ダイスロールコマンド
        # 通常判定部分をgetJudgeResultコマンドに切り分け
        result = getJudgeResult(command)
        return result unless result.nil?

Severity: Minor
Found in lib/bcdice/game_system/Paradiso.rb - About 35 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 proc_dice_2nd has a Cognitive Complexity of 7 (exceeds 5 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 35 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def check_roll(string)
        parser = Command::Parser.new(/RC\d+/, round_type: round_type)
                                .restrict_cmp_op_to(nil)
        cmd = parser.parse(string)
        return nil unless cmd
Severity: Minor
Found in lib/bcdice/game_system/DesperateRun.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def check_action(command)
        m = /^(\d+)(?:NC|D6?)((?:[-+]\d+)*)(>=(\d+))?$/i.match(command)
        dice_count = m[1].to_i
        modify_str = m[2]
        modify_number = ArithmeticEvaluator.eval(modify_str)
Severity: Minor
Found in lib/bcdice/game_system/NeverCloud.rb - About 35 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 compare_result has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def compare_result(success)
        if success < 0
          Result.fumble(translate("fumble"))
        elsif success == 0
          Result.failure(translate("failure"))
Severity: Minor
Found in lib/bcdice/game_system/Emoklore.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def eval_game_system_specific_command(command)
        case command
        when /^Gr(\d+)?/i
          if command =~ /^Gr(\d+)/i
            growth(Regexp.last_match(1).to_i)
Severity: Minor
Found in lib/bcdice/game_system/SwordWorld2_0.rb - About 35 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_ability has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def roll_ability(command)
        parser = Command::Parser.new("MS", round_type: @round_type)
                                .has_prefix_number
                                .disable_modifier
                                .restrict_cmp_op_to(:<=)
Severity: Minor
Found in lib/bcdice/game_system/MamonoScramble.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def check_action(command)
        case command
        when "ID"
          eval_common_command("3TY6")
        when "IE"
Severity: Minor
Found in lib/bcdice/game_system/IfIfIf.rb - About 35 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_2d6 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def result_2d6(total, dice_total, dice_list, cmp_op, target)
        return nil if target == '?'
        return nil unless cmp_op == :>=

        result =
Severity: Minor
Found in lib/bcdice/game_system/MagicaLogia.rb - About 35 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 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def result(total)
          if total <= @critical
            Result.critical("クリティカル!")
          elsif total >= @fumble
            Result.fumble("ファンブル!")
Severity: Minor
Found in lib/bcdice/game_system/FilledWith.rb - About 35 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 sum_of_largest_straight has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def sum_of_largest_straight(sorted_dice_values)
          # 出目が3個未満ならば、ストレートは存在しない
          return 0 if sorted_dice_values.length < 3

          # ストレートの和の最大値
Severity: Minor
Found in lib/bcdice/game_system/CthulhuTech.rb - About 35 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 parse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def self.parse(command)
          if (m = /^(\d[+\-\d]*)-(\d+)FW(?:@(\d+))?(?:\#(\d+))?$/.match(command))
            new.tap do |fw|
              fw.dice_count = m[2].to_i
              fw.target = Arithmetic.eval(m[1], RoundType::FLOOR)
Severity: Minor
Found in lib/bcdice/game_system/FilledWith.rb - About 35 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