bcdice/BCDice

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

Summary

Maintainability
C
1 day
Test Coverage
B
89%

Method get_horidasibukuro_table has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def get_horidasibukuro_table(dice)
        output = '1'

        material_kind = [ # 2D6
          "蟲甲",     # 5
Severity: Major
Found in lib/bcdice/game_system/DarkBlaze.rb - About 2 hrs to fix

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

          def get_horidasibukuro_table(dice)
            output = '1'
    
            material_kind = [ # 2D6
              "蟲甲",     # 5
    Severity: Minor
    Found in lib/bcdice/game_system/DarkBlaze.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 get_dice has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

          def get_dice(mod, abl, skl)
            total = 0
            crit = 0
            fumble = 0
            dice_c = 3 + mod.abs
    Severity: Minor
    Found in lib/bcdice/game_system/DarkBlaze.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 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_dice has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def get_dice(mod, abl, skl)
              total = 0
              crit = 0
              fumble = 0
              dice_c = 3 + mod.abs
      Severity: Minor
      Found in lib/bcdice/game_system/DarkBlaze.rb - About 1 hr to fix

        Method check_roll has a Cognitive Complexity of 9 (exceeds 5 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 55 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