bcdice/BCDice

View on GitHub

Showing 809 of 1,233 total issues

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 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

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

      def getSameDieList(diceList)
        sameDiceList = []

        diceList.uniq.each do |i|
          next if i == 1
Severity: Minor
Found in lib/bcdice/game_system/BlindMythos.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 getSuccessResultText has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def getSuccessResultText(diceList, judgeNumber)
        success = 0
        countOne = 0

        diceList.each do |i|
Severity: Minor
Found in lib/bcdice/game_system/BlindMythos.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def eval(game_system, randomizer)
            round_type = game_system.round_type
            notations = @notations.map { |n| n.to_dice(round_type) }
            cmp_op = @cmp_op || game_system.default_cmp_op
            target_number = @target_number&.eval(round_type) || game_system.default_target_number
Severity: Minor
Found in lib/bcdice/common_command/barabara_dice/node.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def eval(game_system, randomizer)
            round_type = game_system.round_type
            cmp_op = @cmp_op || game_system.default_cmp_op
            reroll_cmp_op = @reroll_cmp_op || cmp_op || :>=

Severity: Minor
Found in lib/bcdice/common_command/reroll_dice/node.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(dice_queue, randomizer, reroll_condition, sort)
            dice_list_list = []
            loop_count = 0

            while !dice_queue.empty? && loop_count < REROLL_LIMIT
Severity: Minor
Found in lib/bcdice/common_command/reroll_dice/node.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 checkRoll has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def checkRoll(diceCount)
        debug("EndBreaker diceCount", diceCount)

        rollCount = diceCount # ダブルトリガー

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

    def run_once
      input = Readline.readline(header())&.strip
      unless input
        puts
        return
Severity: Minor
Found in lib/bcdice/repl.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