bcdice/BCDice

View on GitHub
lib/bcdice/game_system/BlindMythos.rb

Summary

Maintainability
D
2 days
Test Coverage
A
100%

File BlindMythos.rb has 379 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module BCDice
  module GameSystem
    class BlindMythos < Base
      # ゲームシステムの識別子
      ID = 'BlindMythos'
Severity: Minor
Found in lib/bcdice/game_system/BlindMythos.rb - About 5 hrs to fix

    Method getRollResult has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

          def getRollResult(rerollCounts, judgeNumberText, judgeNumber, targetNumber, isReRoll, isStop)
            bitList = []
            successList = []
            countOneList = []
            rerollTargetList = []
    Severity: Minor
    Found in lib/bcdice/game_system/BlindMythos.rb - About 3 hrs 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 getTotalResult has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

          def getTotalResult(bitList, successList, countOneList, targetNumber, isStop, canReRoll)
            success = successList.inject { |sum, i| sum + i }
            countOne = countOneList.inject { |sum, i| sum + i }
    
            result = ""
    Severity: Minor
    Found in lib/bcdice/game_system/BlindMythos.rb - About 2 hrs 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 getRollResult has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def getRollResult(rerollCounts, judgeNumberText, judgeNumber, targetNumber, isReRoll, isStop)
            bitList = []
            successList = []
            countOneList = []
            rerollTargetList = []
    Severity: Minor
    Found in lib/bcdice/game_system/BlindMythos.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

        Method getTotalResult has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def getTotalResult(bitList, successList, countOneList, targetNumber, isStop, canReRoll)
                success = successList.inject { |sum, i| sum + i }
                countOne = countOneList.inject { |sum, i| sum + i }
        
                result = ""
        Severity: Minor
        Found in lib/bcdice/game_system/BlindMythos.rb - About 1 hr to fix

          Method getRollResult has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def getRollResult(rerollCounts, judgeNumberText, judgeNumber, targetNumber, isReRoll, isStop)
          Severity: Minor
          Found in lib/bcdice/game_system/BlindMythos.rb - About 45 mins to fix

            Method reRoll has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def reRoll(command, isStop)
                    debug("ReRoll Begin", command)
            
                    return nil unless /^ReRoll([\d,]+)(@(\d+))?>=(\d+)$/i =~ command
            
            
            Severity: Minor
            Found in lib/bcdice/game_system/BlindMythos.rb - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def eval_game_system_specific_command(command)
                    debug("eval_game_system_specific_command Begin")
            
                    result = judgeRoll(command)
                    return result unless result.nil?
            Severity: Minor
            Found in lib/bcdice/game_system/BlindMythos.rb - About 45 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 getTotalResult has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def getTotalResult(bitList, successList, countOneList, targetNumber, isStop, canReRoll)
            Severity: Minor
            Found in lib/bcdice/game_system/BlindMythos.rb - About 45 mins to fix

              Avoid too many return statements within this method.
              Open

                      return roll_tables(command, TABLES)
              Severity: Major
              Found in lib/bcdice/game_system/BlindMythos.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return Result.fumble(result)
                Severity: Major
                Found in lib/bcdice/game_system/BlindMythos.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return Result.success(result)
                  Severity: Major
                  Found in lib/bcdice/game_system/BlindMythos.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return Result.failure(result)
                    Severity: Major
                    Found in lib/bcdice/game_system/BlindMythos.rb - About 30 mins to fix

                      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

                      There are no issues that match your filters.

                      Category
                      Status