bcdice/BCDice

View on GitHub
lib/bcdice/game_system/cthulhu7th/full_auto.rb

Summary

Maintainability
C
1 day
Test Coverage

Method getFullAutoResult has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

        def getFullAutoResult(command)
          m = /^FAR\((-?\d+),(-?\d+),(-?\d+)(?:,(-?\d+)?)?(?:,(-?\w+)?)?(?:,(-?\d+)?)?\)$/i.match(command)
          unless m
            return nil
          end
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 getFullAutoResult has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def getFullAutoResult(command)
          m = /^FAR\((-?\d+),(-?\d+),(-?\d+)(?:,(-?\d+)?)?(?:,(-?\w+)?)?(?:,(-?\d+)?)?\)$/i.match(command)
          unless m
            return nil
          end
Severity: Minor
Found in lib/bcdice/game_system/cthulhu7th/full_auto.rb - About 1 hr to fix

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

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

              def getBulletResults(bullet_count, hit_type, diff, bullet_set_count_cap)
                bullet_set_count = getSetOfBullet(diff, bullet_set_count_cap)
                hit_bullet_count_base = getHitBulletCountBase(diff, bullet_set_count)
                impale_bullet_count_base = (bullet_set_count / 2.to_f)
      
      
      Severity: Minor
      Found in lib/bcdice/game_system/cthulhu7th/full_auto.rb - About 1 hr to fix

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

                def rollFullAuto(bullet_count, diff, broken_number, dice_num, stop_count, bullet_set_count_cap)
        Severity: Minor
        Found in lib/bcdice/game_system/cthulhu7th/full_auto.rb - About 45 mins to fix

          Avoid too many return statements within this method.
          Open

                      return "エラー。ボーナス・ペナルティダイスの値は#{BONUS_DICE_RANGE.min}~#{BONUS_DICE_RANGE.max}です。"
          Severity: Major
          Found in lib/bcdice/game_system/cthulhu7th/full_auto.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                      return output
            Severity: Major
            Found in lib/bcdice/game_system/cthulhu7th/full_auto.rb - About 30 mins to fix

              Method getBulletResults has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                      def getBulletResults(bullet_count, hit_type, diff, bullet_set_count_cap)
                        bullet_set_count = getSetOfBullet(diff, bullet_set_count_cap)
                        hit_bullet_count_base = getHitBulletCountBase(diff, bullet_set_count)
                        impale_bullet_count_base = (bullet_set_count / 2.to_f)
              
              
              Severity: Minor
              Found in lib/bcdice/game_system/cthulhu7th/full_auto.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