bcdice/BCDice

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

Summary

Maintainability
D
1 day
Test Coverage
B
89%

File Satasupe.rb has 291 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "bcdice/game_system/satasupe/tables"

module BCDice
  module GameSystem
    class Satasupe < Base
Severity: Minor
Found in lib/bcdice/game_system/Satasupe.rb - About 3 hrs to fix

    Method check_roll_loop has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

          def check_roll_loop(roll_times, min_suc, target, critical, fumble, is_critical_stop)
            dice_str = ''
            is_fumble = false
            is_critical = false
            total_suc = 0
    Severity: Minor
    Found in lib/bcdice/game_system/Satasupe.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 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 checkRoll has a Cognitive Complexity of 12 (exceeds 5 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

      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 getCreateSatasupeResult has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def getCreateSatasupeResult(counts)
              debug("getCreateSatasupeResult counts", counts)
      
              name = "サタスペ作成"
      
      
      Severity: Minor
      Found in lib/bcdice/game_system/Satasupe.rb - About 1 hr to fix

        Method check_roll_loop has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def check_roll_loop(roll_times, min_suc, target, critical, fumble, is_critical_stop)
                dice_str = ''
                is_fumble = false
                is_critical = false
                total_suc = 0
        Severity: Minor
        Found in lib/bcdice/game_system/Satasupe.rb - About 1 hr to fix

          Method get_roll_params has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def get_roll_params(params)
                  min_suc = 0
                  fumble = 1
                  critical = 13
                  isCriticalStop = false
          Severity: Minor
          Found in lib/bcdice/game_system/Satasupe.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 check_roll_loop has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def check_roll_loop(roll_times, min_suc, target, critical, fumble, is_critical_stop)
          Severity: Minor
          Found in lib/bcdice/game_system/Satasupe.rb - About 45 mins to fix

            Method check_seigou has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def check_seigou(string)
                    debug("check_seigou begin string", string)
            
                    sr_parser = Command::Parser.new("SR", round_type: round_type)
                                               .has_suffix_number
            Severity: Minor
            Found in lib/bcdice/game_system/Satasupe.rb - About 35 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