bcdice/BCDice

View on GitHub

Showing 837 of 1,278 total issues

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

      def expr_r()
        modify_number = Format.modifier(@cmd.modify_number)
        critical = @critical == 12 ? "" : "c[#{@critical}]"
        fumble = @fumble == 2 ? "" : "f[#{@fumble}]"
        brak = @break == 0 ? "" : "b[#{@break}]"
Severity: Minor
Found in lib/bcdice/game_system/OracleEngine.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 roll_sedative has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def roll_sedative(command)
        parser = Command::Parser.new("SE", round_type: @round_type)
                                .has_suffix_number
        parsed = parser.parse(command)
        unless parsed
Severity: Minor
Found in lib/bcdice/game_system/KizunaBullet.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_nd6_only has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

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

        if dice_total <= 2
          Result.fumble("絶対失敗")
Severity: Minor
Found in lib/bcdice/game_system/MeikyuKingdom.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 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 roll_mal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def roll_mal(command)
        m = /^MAL(\d{1,2})$/i.match(command)
        return nil unless m

        mal = m[1].to_i
Severity: Minor
Found in lib/bcdice/game_system/CastleInGray.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_nd6 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def result_nd6(total, _dice_total, dice_list, cmp_op, target)
        n_max = dice_list.count(6)

        if dice_list.count(1) == dice_list.size
          # 全部1の目ならファンブル
Severity: Minor
Found in lib/bcdice/game_system/Arianrhod.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 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 use_petit_quest_chart has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def use_petit_quest_chart(command)
        match_data = command.match(/PQ([VA]?)/)
        chart_symbol = match_data[1] == '' ? 'V' : match_data[1]

        roll_result1 = @randomizer.roll_once(D6)
Severity: Minor
Found in lib/bcdice/game_system/Villaciel.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 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 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 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 get_condition_text has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def get_condition_text(opts)
        if opts.favoured_state == FavouredState::NORMAL && !opts.weary && !opts.miserable
          return ""
        end

Severity: Minor
Found in lib/bcdice/game_system/TheOneRing2nd.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, 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 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 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

Severity
Category
Status
Source
Language