bcdice/BCDice

View on GitHub

Showing 1,176 of 1,233 total issues

Method eval_game_system_specific_command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def eval_game_system_specific_command(command)
        case command
        when /\AFF/
          # 対抗なしロール
          # '成功' or '失敗' を出力する
Severity: Minor
Found in lib/bcdice/game_system/AFF2e.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

      def parse(command)
        m = TEST_RE.match(command)
        return nil unless m

        num = m[1].to_i
Severity: Minor
Found in lib/bcdice/game_system/CthulhuTech.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

      def result_2d6(total, dice_total, _dice_list, cmp_op, target)
        if dice_total >= 12
          Result.critical(translate('SwordWorld.critical'))
        elsif dice_total <= 2
          Result.fumble(translate('SwordWorld.fumble'))
Severity: Minor
Found in lib/bcdice/game_system/SwordWorld.rb - About 25 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_ad has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def roll_ad(command)
        m = /^(\d*)AD(\d*)<=(\d+)$/.match(command)
        return nil unless m

        times = m[1]
Severity: Minor
Found in lib/bcdice/game_system/ArknightsFan.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

      def parse(command)
        prefix_re = Regexp.new(["2D6"].concat(aliases()).join('|'), Regexp::IGNORECASE)
        parser = Command::Parser.new(prefix_re, round_type: @round_type)
                                .enable_critical
                                .enable_fumble
Severity: Minor
Found in lib/bcdice/game_system/SRS.rb - About 25 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 mk_name_table has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def mk_name_table
        debug("mk_name_table begin")
        output = "1"
        # 名前表
        name_n = @randomizer.roll_once(6)
Severity: Minor
Found in lib/bcdice/game_system/meikyu_kingdom/name_tables.rb - About 25 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 process_b has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def process_b(times, sides, target)
        dice_list = @randomizer.roll_barabara(times, sides).sort

        success_count = 0
        critical_count = 0
Severity: Minor
Found in lib/bcdice/game_system/ArknightsFan.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

        def roll(randomizer)
          chosen = super(randomizer)

          m = @reroll_reg.match(chosen.body)
          unless m
Severity: Minor
Found in lib/bcdice/game_system/beginning_idol/skill_table.rb - About 25 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 calc_total has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def calc_total
          total = @dice_total + @modify_number
          if fumble?
            total = 0 unless @keep_value_on_fumble
          elsif critical?
Severity: Minor
Found in lib/bcdice/game_system/BeastBindTrinity.rb - About 25 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_symphony_check has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def roll_symphony_check(command)
        m = /^([1-6]+)PD([1-6])([+-]\d+)?$/.match(command)
        unless m
          return nil
        end
Severity: Minor
Found in lib/bcdice/game_system/BeginningIdol2022.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

        def roll(randomizer, roll_counts = 1)
          if roll_counts == 0
            return nil
          end

Severity: Minor
Found in lib/bcdice/game_system/beginning_idol/item_table.rb - About 25 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 getBulletResults has a Cognitive Complexity of 6 (exceeds 5 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 25 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_monster has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def get_monster(command)
        m = command.match(/^CM(\w)(\d+)$/i)
        return nil unless m

        cat = COLOR_TABLE.index(m[1])
Severity: Minor
Found in lib/bcdice/game_system/CardRanker.rb - About 25 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 fate_treasure has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def fate_treasure(natural_result, order)
        modified_result = natural_result.dup
        subtotal = results_multiplication(natural_result)
        total = subtotal
        if order.length > 2 && order[2] =~ /^\d+$/
Severity: Minor
Found in lib/bcdice/game_system/HeroScale.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

        def roll(randomizer, chance = nil)
          chosen = super(randomizer)
          unless chance
            return chosen
          end
Severity: Minor
Found in lib/bcdice/game_system/beginning_idol/work_table.rb - About 25 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 with_difficulty_level has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def self.with_difficulty_level(total, difficulty)
          fumble = difficulty < 50 ? 96 : 100

          if total == 1
            ResultLevel.new(:critical)
Severity: Minor
Found in lib/bcdice/game_system/Cthulhu7th.rb - About 25 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_roll_result has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def get_roll_result(diceList, crit, diff)
        success, maxnum, setCount = getSuccessInfo(diceList, crit)

        sequence = []

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

      def do_resistance_roll(command)
        m = %r{\A(RES)([+-/*\d]+)(M([+-/*\d]+))?$}.match(command)
        unless m
          return nil
        end
Severity: Minor
Found in lib/bcdice/game_system/RuneQuestRoleplayingInGlorantha.rb - About 25 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_attack has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def roll_attack(command)
        m = /^PT(-?\d+)?(@(-?\d+))?$/i.match(command)
        unless m
          return nil
        end
Severity: Minor
Found in lib/bcdice/game_system/PersonaO.rb - About 25 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_df has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def roll_df(command)
        parser = Command::Parser.new("DF", round_type: @round_type)
                                .enable_prefix_number()
                                .restrict_cmp_op_to(:>=, nil)

Severity: Minor
Found in lib/bcdice/game_system/FateCoreSystem.rb - About 25 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