bcdice/BCDice

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

Summary

Maintainability
B
5 hrs
Test Coverage

Method roll_d has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def roll_d(command, times, sides, target)
        dice_list = @randomizer.roll_barabara(times, sides).sort
        total = dice_list.sum
        success = total <= target

Severity: Minor
Found in lib/bcdice/game_system/ArknightsFan.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_d has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def roll_d(command, times, sides, target)
        dice_list = @randomizer.roll_barabara(times, sides).sort
        total = dice_list.sum
        success = total <= target

Severity: Minor
Found in lib/bcdice/game_system/ArknightsFan.rb - About 1 hr to fix

    Method roll_ab has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def roll_ab(command)
            m = /^(\d*)AB(\d*)<=(\d+)(?:--([^\d\s]+)(0)?)?$/.match(command)
            return nil unless m
    
            times = m[1]
    Severity: Minor
    Found in lib/bcdice/game_system/ArknightsFan.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

    Method roll_b_withtype has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def roll_b_withtype(command, times, sides, target, type)
    Severity: Minor
    Found in lib/bcdice/game_system/ArknightsFan.rb - About 35 mins to fix

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

            def process_b(times, sides, target)
              dice_list = @randomizer.roll_barabara(times, sides).sort
      
              success_count = 0
              critical_count = 0
      Severity: Minor
      Found in lib/bcdice/game_system/ArknightsFan.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 roll_ad has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def roll_ad(command)
              m = /^(\d*)AD(\d*)<=(\d+)$/.match(command)
              return nil unless m
      
              times = m[1]
      Severity: Minor
      Found in lib/bcdice/game_system/ArknightsFan.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