bcdice/BCDice

View on GitHub

Showing 829 of 1,274 total issues

Method getDamageResult has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def getDamageResult(command)
        biggun = [0, 0, 0]

        case command
        when /^DC(\d+)(\[(\d+)(,(\d+))?(,(\d+))?(,(\d+))?(,(\d+))?(,(\d+))?\])?$/i
Severity: Minor
Found in lib/bcdice/game_system/Paradiso.rb - About 1 hr to fix

    Method initiative_roll has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def initiative_roll(command)
            m = /^(\d+\.?\d*)?(INTI|inti)([+-](\d+))?(#(\d+))?/.match(command)
            unless m
              return nil
            end
    Severity: Minor
    Found in lib/bcdice/game_system/TheUnofficialHollowKnightRPG.rb - About 1 hr to fix

      Method getJudgeResult has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def getJudgeResult(command)
              case command
              when /^(\d+)?D20<=(\d+)?(\[(\d+)(,(\d+))?\])?(@(\d+))?$/i
                number = (Regexp.last_match(1) || 1).to_i # ダイス数。省略時は1
                target = (Regexp.last_match(2) || 14).to_i # 目標値。省略時は14  if 空白 then 14 else 記載の値
      Severity: Minor
      Found in lib/bcdice/game_system/Paradiso.rb - About 1 hr to fix

        Method getWeaponTable has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def getWeaponTable(weaponCommand)
                debug('getWeaponTable weaponCommand', weaponCommand)
        
                case weaponCommand.upcase
                when 'SW'
        Severity: Minor
        Found in lib/bcdice/game_system/ShinkuuGakuen.rb - About 1 hr to fix

          Method getExtraTableResult has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def getExtraTableResult(type)
                  tableName = translate("KillDeathBusiness.EXT.name")
                  extraTable1 = [
                    [11, translate("KillDeathBusiness.EXT.table1.11")],
                    [12, translate("KillDeathBusiness.EXT.table1.12")],
          Severity: Minor
          Found in lib/bcdice/game_system/KillDeathBusiness.rb - About 1 hr to fix

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

                  def eval_game_system_specific_command(command)
                    string = command.upcase
                    string = replace_text(string)
            
                    if (result = torg_check(string))
            Severity: Minor
            Found in lib/bcdice/game_system/Torg.rb - About 1 hr to fix

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

                Method getCreateNpcDiceCommandResult has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def getCreateNpcDiceCommandResult(command)
                        return nil unless command =~ /^CNP$/
                
                        name = "NPC作成表"
                        table = [
                Severity: Minor
                Found in lib/bcdice/game_system/ColossalHunter.rb - About 1 hr to fix

                  Method skill_roll has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def skill_roll(command)
                          m = /^CC([-+]?\d+)?(?:<=(\d+)([RHEC])?)?$/.match(command)
                          unless m
                            return nil
                          end
                  Severity: Minor
                  Found in lib/bcdice/game_system/Cthulhu7th.rb - About 1 hr to fix

                    Method parse has 45 lines of code (exceeds 25 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

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

                            def eval_game_system_specific_command(command)
                              m = /\A(\d+)?(YZE|MYZ)(\d+)((\+|-)(\d+))?(\+(\d+))?/.match(command)
                              unless m
                                return ''
                              end
                      Severity: Minor
                      Found in lib/bcdice/game_system/YearZeroEngine.rb - About 1 hr to fix

                        Method get_roll_result has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              def get_roll_result(result_text, success_dice, ten_dice, _desperaton_ten_dice, desperaton_botch_dice, difficulty)
                                result_text = "#{result_text} 成功数=#{success_dice}"
                                is_critical = ten_dice >= 2
                                desperation_result = ""
                        
                        
                        Severity: Minor
                        Found in lib/bcdice/game_system/HunterTheReckoning5th.rb - About 1 hr to fix

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

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

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

                                  def getJudgeResult(command)
                                    case command
                                    when /^(\d+)?D20<=(\d+)?(\[(\d+)(,(\d+))?\])?(@(\d+))?$/i
                                      number = (Regexp.last_match(1) || 1).to_i # ダイス数。省略時は1
                                      target = (Regexp.last_match(2) || 14).to_i # 目標値。省略時は14  if 空白 then 14 else 記載の値
                            Severity: Minor
                            Found in lib/bcdice/game_system/Paradiso.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 a Cognitive Complexity of 14 (exceeds 5 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

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

                                  def roll_color(command)
                                    m = /^B(\d{1,2})W(\d{1,2})$/.match(command)
                                    return nil unless m
                            
                                    black = m[1].to_i
                            Severity: Minor
                            Found in lib/bcdice/game_system/CastleInGray.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 mayokin_check has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                            Open

                                  def mayokin_check(string)
                                    debug("mayokin_check string", string)
                            
                                    string = replace_text(string)
                            
                            
                            Severity: Minor
                            Found in lib/bcdice/game_system/MeikyuKingdom.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_nd6 has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                            Open

                                  def result_nd6(total, dice_total, dice_list, cmp_op, target)
                                    return Result.nothing if target == '?'
                                    return nil unless dice_list.size == 3 && cmp_op == :<=
                            
                                    success = target - total # 成功度
                            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 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

                            Severity
                            Category
                            Status
                            Source
                            Language