bcdice/BCDice

View on GitHub

Showing 837 of 1,278 total issues

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

    def debug(target, *values)
      return unless @debug

      targetStr = target.is_a?(String) ? target : target.inspect

Severity: Minor
Found in lib/bcdice/base.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_action has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def check_action(command)
        parser = Command::Parser.new("ZL", round_type: @round_type)
                                .enable_prefix_number
                                .disable_modifier
                                .restrict_cmp_op_to(:<=)
Severity: Minor
Found in lib/bcdice/game_system/ZombiLine.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_treat has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def roll_treat(command)
        m = /^TREAT(-?\d+)?$/.match(command)
        return nil unless m

        unless m[1]
Severity: Minor
Found in lib/bcdice/game_system/Yggdrasill.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 action_roll has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def action_roll(command)
        parser = Command::Parser.new("D6", round_type: round_type)
                                .has_prefix_number
                                .restrict_cmp_op_to(:>=)
                                .enable_critical
Severity: Minor
Found in lib/bcdice/game_system/StarryDolls.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_lostroyal has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def check_lostroyal(checking_table)
        keys = []

        3.times do |_i|
          key = @randomizer.roll_once(6)
Severity: Minor
Found in lib/bcdice/game_system/LostRoyal.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 rokumon2_roll has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def rokumon2_roll(mod, target, abl)
        suc = 0

        dice = @randomizer.roll_barabara(3 + mod.abs, 6).sort
        dicestr = dice.join(",")
Severity: Minor
Found in lib/bcdice/game_system/RokumonSekai2.rb - About 1 hr to fix

    Method getBulletResults has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def getBulletResults(bullet_count, hit_type, diff)
            bullet_set_count = getSetOfBullet(diff)
            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_Korean.rb - About 1 hr to fix

      Method eval_game_system_specific_command has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def eval_game_system_specific_command(command)
              case command
              when /CCB/i
                # 5%
                @critical_percentage = 5
      Severity: Minor
      Found in lib/bcdice/game_system/Cthulhu.rb - About 1 hr to fix

        Method checkRoll has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def checkRoll(diceCount, target, damage, criticalTrigger, criticalNumber)
                totalSuccessCount = 0
                totalCriticalCount = 0
                text = ""
        
        
        Severity: Minor
        Found in lib/bcdice/game_system/Airgetlamh.rb - About 1 hr to fix

          Method result_2d6 has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def result_2d6(total, dice_total, _dice_list, cmp_op, target)
                  return Result.nothing if target == '?'
                  return nil unless [:>=, :>].include?(cmp_op)
          
                  critical = false
          Severity: Minor
          Found in lib/bcdice/game_system/SharedFantasia.rb - About 1 hr to fix

            Method result_1d20 has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def result_1d20(total, _dice_total, cmp_op, target)
                    return Result.nothing if target == '?'
                    return nil unless cmp_op == :<=
            
                    if total > target
            Severity: Minor
            Found in lib/bcdice/game_system/InfiniteFantasia.rb - About 1 hr to fix

              Method eval_game_system_specific_command has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def eval_game_system_specific_command(command)
                      command = command
                                .sub(/Lv(\d+)/i) { (Regexp.last_match(1).to_i * 5 - 1).to_s }
                                .sub(/NL(\d+)/i) { (Regexp.last_match(1).to_i * 5 + 5).to_s }
              
              
              Severity: Minor
              Found in lib/bcdice/game_system/NightmareHunterDeep.rb - About 1 hr to fix

                Method eval_game_system_specific_command has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def eval_game_system_specific_command(command)
                        m = /\A(\d+)?(((WAF)(\d+)(\+(\d+))?)|((WAI)(\d+)(R(\d+))?))$/.match(command)
                        unless m
                          return ''
                        end
                Severity: Minor
                Found in lib/bcdice/game_system/WerewolfTheApocalypse5th.rb - About 1 hr to fix

                  Method result_nd6 has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def result_nd6(total, dice_total, dice_list, cmp_op, target)
                          return Result.nothing if target == '?'
                          return nil unless dice_list.size == 3 && cmp_op == :<=
                  
                          success = target - total # 成功度
                  Severity: Minor
                  Found in lib/bcdice/game_system/GurpsFW.rb - About 1 hr to fix

                    Method roll_investigate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def roll_investigate(command)
                            parser = Command::Parser.new("IN", round_type: @round_type)
                                                    .has_prefix_number
                            parsed = parser.parse(command)
                            unless parsed
                    Severity: Minor
                    Found in lib/bcdice/game_system/KizunaBullet.rb - About 1 hr to fix

                      Method resolute_action has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def resolute_action(num_dices, defence, dice_change_text)
                              dices = @randomizer.roll_barabara(num_dices, 6).sort
                              dice_text = dices.join(",")
                      
                              output = "(#{remake_command(num_dices, defence, dice_change_text)}) > #{dice_text}"
                      Severity: Minor
                      Found in lib/bcdice/game_system/StellarKnights.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 checkRoll has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                def checkRoll(diceCount, target, damage, criticalTrigger, criticalNumber)
                                  totalSuccessCount = 0
                                  totalCriticalCount = 0
                                  text = ""
                          
                          
                          Severity: Minor
                          Found in lib/bcdice/game_system/Avandner.rb - About 1 hr to fix

                            Method result_detail has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  def result_detail(sl, total, target)
                                    if sl == 0
                                      if total <= 5
                                        '小成功'
                                      elsif total >= 96
                            Severity: Minor
                            Found in lib/bcdice/game_system/Warhammer4.rb - About 1 hr to fix

                              Method get_develop_matome_table has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                    def get_develop_matome_table
                                      output1 = ''
                                      output2 = ''
                                      total_n2 = ""
                              
                              
                              Severity: Minor
                              Found in lib/bcdice/game_system/KanColle.rb - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language