bcdice/BCDice

View on GitHub

Showing 832 of 1,271 total issues

Method getReactionText has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

      def getReactionText(name, typeText1, typeText2, infos1, infos2)
        return nil unless checkTypeText(typeText1, infos1)
        return nil unless checkTypeText(typeText2, infos2)

        ten_value = @randomizer.roll_once(6)
Severity: Minor
Found in lib/bcdice/game_system/Dracurouge.rb - About 1 hr 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 getRandomEvent has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

      def getRandomEvent(dice1, dice2, diff)
        case diff
        when "E"
          dif = "初級"
          d = 0
Severity: Minor
Found in lib/bcdice/game_system/GurpsFW.rb - About 1 hr 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_horidasibukuro_table has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

      def get_horidasibukuro_table(dice)
        output = '1'

        material_kind = [ # 2D6
          "蟲甲",     # 5
Severity: Minor
Found in lib/bcdice/game_system/DarkBlaze.rb - About 1 hr 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 14 (exceeds 5 allowed). Consider refactoring.
Open

      def result_1d100(total, _dice_total, cmp_op, target)
        return nil unless cmp_op == :<=

        if total >= 100
          Result.fumble("ファンブル")
Severity: Minor
Found in lib/bcdice/game_system/Gundog.rb - About 1 hr 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 judgeRoll has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

      def judgeRoll(command)
        return nil unless /^(R([A-DS]|\d+)([+\-\d,]*))(@(\d))?((>(=)?)([+\-\d]*))?(@(\d))?$/i =~ command

        skillRank = Regexp.last_match(2)
        modifyText = Regexp.last_match(3)
Severity: Minor
Found in lib/bcdice/game_system/HatsuneMiku.rb - About 1 hr 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_detail has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

      def result_detail(sl, total, target)
        if sl == 0
          if total <= 5
            '小成功'
          elsif total >= 96
Severity: Minor
Found in lib/bcdice/game_system/Warhammer4.rb - About 1 hr 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 14 (exceeds 5 allowed). Consider refactoring.
Open

      def checkRoll(string)
        string = replace_text(string)

        return nil unless /(^|\s)S?(2[rR]10([+\-\d]+)?([>=]+(\d+))(\[(\d+),(\d+)\]))(\s|$)/i =~ string

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

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

      def roll_barna_kronika(dice_n, criticalCallDice)
        dice_n = dice_n.to_i

        output = ''
        suc = 0
Severity: Minor
Found in lib/bcdice/game_system/BarnaKronika.rb - About 1 hr to fix

    Method checkRoll has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def checkRoll(diceCount, choiceCount, target)
            if diceCount <= 0
              correction = 1 + diceCount * -1
              rollCount = 1
            else
    Severity: Minor
    Found in lib/bcdice/game_system/Raisondetre.rb - About 1 hr to fix

      Method getSuccessTable has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def getSuccessTable
              successTable =
                [
                  #       Pathetic Poor Average Good Excellent Extraordinary
                  [2, [0, 1, 2, 5, 7, 9]],
      Severity: Minor
      Found in lib/bcdice/game_system/EarthDawn3.rb - About 1 hr to fix

        Method eval_game_system_specific_command has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def eval_game_system_specific_command(command)
                debug("eval_game_system_specific_command Begin")
        
                parser = Command::Parser.new('SBS', 'SB', round_type: round_type)
                                        .enable_critical
        Severity: Minor
        Found in lib/bcdice/game_system/SamsaraBallad.rb - About 1 hr to fix

          Method roll_ub has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def roll_ub(command)
                  parser = Command::Parser.new("UB", round_type: @round_type)
                                          .has_prefix_number
                                          .enable_critical
                  parsed = parser.parse(command)
          Severity: Minor
          Found in lib/bcdice/game_system/Karukami.rb - About 1 hr to fix

            Method judgeRoll has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def judgeRoll(command)
                    return nil unless /^(R([A-DS]|\d+)([+\-\d,]*))(@(\d))?((>(=)?)([+\-\d]*))?(@(\d))?$/i =~ command
            
                    skillRank = Regexp.last_match(2)
                    modifyText = Regexp.last_match(3)
            Severity: Minor
            Found in lib/bcdice/game_system/HatsuneMiku.rb - About 1 hr to fix

              Method checkRoll has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def checkRoll(string)
                      debug("checkRoll begin string", string)
              
                      m = /^(\d+)R>=(\d+)(\[(\d+)?(,|,\d+)?(,\d+(S)?)?\])?$/i.match(string)
                      return nil unless m
              Severity: Minor
              Found in lib/bcdice/game_system/Satasupe.rb - About 1 hr to fix

                Method check_action has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def check_action(command)
                        parser = Command::Parser.new("ZL", round_type: @round_type)
                                                .enable_prefix_number
                                                .disable_modifier
                                                .restrict_cmp_op_to(:<=)
                Severity: Minor
                Found in lib/bcdice/game_system/ZombiLine.rb - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if order.length > 9 && order[2] =~ /^\d+$/ && order[3] =~ /^\d+$/ && order[4] =~ /^\d+$/ && order[5] =~ /^\d+$/ && order[6] =~ /^\d+$/ && order[7] =~ /^\d+$/ && order[8] =~ /^\d+$/ && order[9] =~ /^\d+$/
                            if order[2].to_i > 0
                              modified_result.concat(@randomizer.roll_barabara(order[2].to_i, 2))
                            end
                            if order[3].to_i > 0
                  Severity: Critical
                  Found in lib/bcdice/game_system/HeroScale.rb - About 1 hr to fix

                    Method roll_action has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def roll_action(command)
                            parser = Command::Parser.new("DS", round_type: @round_type)
                                                    .enable_prefix_number
                                                    .restrict_cmp_op_to(nil)
                            parsed = parser.parse(command)
                    Severity: Minor
                    Found in lib/bcdice/game_system/DemonSpike.rb - About 1 hr to fix

                      Method fate_monster has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def fate_monster(_natural_result, order)
                              modified_result = []
                              if order.length > 9 && order[2] =~ /^\d+$/ && order[3] =~ /^\d+$/ && order[4] =~ /^\d+$/ && order[5] =~ /^\d+$/ && order[6] =~ /^\d+$/ && order[7] =~ /^\d+$/ && order[8] =~ /^\d+$/ && order[9] =~ /^\d+$/
                                if order[2].to_i > 0
                                  modified_result.concat(@randomizer.roll_barabara(order[2].to_i, 2))
                      Severity: Minor
                      Found in lib/bcdice/game_system/HeroScale.rb - About 1 hr to fix

                        Method getDurtyTableCommandReuslt has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              def getDurtyTableCommandReuslt(command)
                                return nil unless /^DT$/i =~ command
                        
                                table = <<~__TABLE_END__
                                  汚染チャートを2回振り、その効果を適用する(1・2-2,5・6-12 なら振り直す)
                        Severity: Minor
                        Found in lib/bcdice/game_system/BlindMythos.rb - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language