bcdice/BCDice

View on GitHub

Showing 837 of 1,278 total issues

Method checkDamage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def checkDamage(diceCount, armor)
        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

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 getSuccessText has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def getSuccessText(allTotal, diff, diceList, isWeapon)
        first = diceList.first
        return '' if first.nil?

        return " > ファンブル" if first <= 9
Severity: Minor
Found in lib/bcdice/game_system/ShinkuuGakuen.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 rollFullAuto has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        def rollFullAuto(bullet_count, diff, broken_number, dice_num, stop_count, bullet_set_count_cap)
          output = ""
          loopCount = 0

          counts = {
Severity: Minor
Found in lib/bcdice/game_system/cthulhu7th/full_auto.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 getCrashWorldRoll has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def getCrashWorldRoll(target)
        debug("target", target)

        output = "("
        isEnd = false
Severity: Minor
Found in lib/bcdice/game_system/CrashWorld.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 do_resistance_active_characteristic_roll has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

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

      def roll_general_skill(command)
        m = /^GS([-+][-+\d]+)?(>([-+\d]+))?/.match(command)
        return nil unless m

        modify = ArithmeticEvaluator.eval(m[1])
Severity: Minor
Found in lib/bcdice/game_system/GundamSentinel.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 parse has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        def parse(command)
          scanner = StringScanner.new(command)
          scanner.skip(/\s+/)

          secret = !scanner.scan(/S/i).nil?
Severity: Minor
Found in lib/bcdice/common_command/choice.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 ability_roll has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def ability_roll(command)
        m = /^(\d+\.?\d*)?AD([+-](\d+))?(#(\d*))?(>=(\d+))?/.match(command)
        unless m
          return nil
        end
Severity: Minor
Found in lib/bcdice/game_system/TheUnofficialHollowKnightRPG.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 eval_game_system_specific_command has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def eval_game_system_specific_command(command)
        result = roll_tables(command, TABLES)
        return result if result

        if (ppc_parse_result = ppc_parser.parse(command))
Severity: Minor
Found in lib/bcdice/game_system/BattleTech.rb - About 1 hr to fix

    Method consciousness_roll has 31 lines of code (exceeds 25 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 1 hr to fix

      Method getHitResult has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def getHitResult(count, damageFunc, tail)
              m = /\A([LCR][LU]?)?(\+\d+)?>=(\d+)/.match(tail)
              return nil unless m
      
              side = m[1] || 'C'
      Severity: Minor
      Found in lib/bcdice/game_system/BattleTech.rb - About 1 hr to fix

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

              def eval_game_system_specific_command(command)
                output =
                  case command.upcase
        
                  when /EMA(\d+)?$/i
        Severity: Minor
        Found in lib/bcdice/game_system/AlterRaise.rb - About 1 hr to fix

          Method action_roll has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def action_roll(command)
                  parser = Command::Parser.new("PP", round_type: round_type)
                                          .restrict_cmp_op_to(:>=, nil)
                                          .enable_critical
                                          .enable_fumble
          Severity: Minor
          Found in lib/bcdice/game_system/PastFutureParadox.rb - About 1 hr to fix

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

                  def checkRoll(diceCount, modify, type, target)
                    diceArray = @randomizer.roll_barabara(diceCount, 6).sort
                    dice = diceArray.sum()
                    diceText = diceArray.join(",")
            
            
            Severity: Minor
            Found in lib/bcdice/game_system/Postman.rb - About 1 hr to fix

              Method roll_wind_power_chart has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def roll_wind_power_chart
                      key = 0
                      total_bonus = 0
                      text = ""
              
              
              Severity: Minor
              Found in lib/bcdice/game_system/LostRoyal.rb - About 1 hr to fix

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

                      def eval_game_system_specific_command(command)
                        debug('eval_game_system_specific_command begin')
                
                        unless command =~ /^R(\d+)(,(\d+))?([+\-\d]+)?(>=(\d+))?/
                          debug('unmatched!')
                Severity: Minor
                Found in lib/bcdice/game_system/Ryutama.rb - About 1 hr to fix

                  Method check_roll has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def check_roll(string)
                          string = replace_text(string)
                          return nil unless (m = /(^|\s)S?(3[rR]6([+\-\d]+)?(\[(\d+),(\d+)\])(([>=]+)(\d+))?)(\s|$)/i.match(string))
                  
                          string = m[2]
                  Severity: Minor
                  Found in lib/bcdice/game_system/DarkBlaze.rb - About 1 hr to fix

                    Method get_urge has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def get_urge(string) # パラサイトブラッドの衝動表
                            unless /(\w*)URGE\s*(\d+)/i =~ string
                              return '1'
                            end
                    
                    
                    Severity: Minor
                    Found in lib/bcdice/game_system/ParasiteBlood.rb - About 1 hr to fix

                      Method mk_item_features_table has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def mk_item_features_table(num)
                              output = ""
                              dice = @randomizer.roll_sum(2, 6)
                      
                              if num <= 2
                      Severity: Minor
                      Found in lib/bcdice/game_system/meikyu_kingdom/item_table.rb - About 1 hr to fix

                        Method abirity_roll has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              def abirity_roll(command)
                                parser = Command::Parser.new("AB", round_type: round_type)
                                                        .enable_prefix_number()
                                                        .restrict_cmp_op_to(:>=, nil)
                                cmd = parser.parse(command)
                        Severity: Minor
                        Found in lib/bcdice/game_system/FinalFantasyXIV.rb - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language