bcdice/BCDice

View on GitHub

Showing 837 of 1,278 total issues

Avoid too many return statements within this method.
Open

          return roll_hope(Regexp.last_match(1).to_i)
Severity: Major
Found in lib/bcdice/game_system/LostRoyal.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return nil
    Severity: Major
    Found in lib/bcdice/common_command/choice.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return '', []
      Severity: Major
      Found in lib/bcdice/game_system/Elysion.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

              return ret if ret
        Severity: Major
        Found in lib/bcdice/base.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return 'Poor(お粗末)' if stepTotal >= poor
          Severity: Major
          Found in lib/bcdice/game_system/EarthDawn3.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return "失敗"
            Severity: Major
            Found in lib/bcdice/game_system/Cthulhu7th_ChineseTraditional.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return Result.failure(output)
              Severity: Major
              Found in lib/bcdice/game_system/DivineCharger.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_ChineseTraditional.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 = 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 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 pick_item has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def pick_item(index)
                            if index <= 6
                              translate("LogHorizon.TRS.below_lower_limit", value: 6) # 6以下の出目は未定義です
                            elsif index <= 62
                              @items[index]
                  Severity: Minor
                  Found in lib/bcdice/game_system/LogHorizon.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 check_roll has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def check_roll(command)
                          m = /^(\d+)?ATK([1-6]{0,6})$/.match(command)
                          return nil unless m
                  
                          dice_count = m[1]&.to_i || 1
                  Severity: Minor
                  Found in lib/bcdice/game_system/LiveraDoll.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 parse_nw has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def parse_nw(string)
                          m = /^([-+]?\d+)?#{@nw_command}((?:[-+]\d+)+)?(?:@(\d+(?:,\d+)*))?(?:#(\d+(?:,\d+)*))?(?:\$(\d+))?((?:[-+]\d+)+)?(?:([>=]+)(\d+))?$/.match(string)
                          unless m
                            return nil
                          end
                  Severity: Minor
                  Found in lib/bcdice/game_system/NightWizard.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 pick_item has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def pick_item(index)
                            if index <= 6
                              translate("LogHorizon.TRS.below_lower_limit", value: 6)
                            elsif index <= 162
                              @items[index]
                  Severity: Minor
                  Found in lib/bcdice/game_system/LogHorizon.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def roll(cr, modifier, randomizer)
                            return nil if cr == 0 && modifier == 0
                  
                            index =
                              if cr == 0 && modifier != 0
                  Severity: Minor
                  Found in lib/bcdice/game_system/LogHorizon.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_ot has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def roll_ot(command)
                          m = /^(\d+)OT>=(\d+)$/.match(command)
                          return nil unless m
                  
                          times = m[1].to_i
                  Severity: Minor
                  Found in example/OnseTool.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 judge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def judge(target, total)
                          double = (total / 10) == (total % 10)
                          total_text = format00(total)
                          if total <= target
                            double ? Result.critical("(#{total_text})クリティカル") : Result.success("(#{total_text})成功")
                  Severity: Minor
                  Found in lib/bcdice/game_system/AssaultEngine.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 return_result has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def return_result(result1, result2, text)
                          if result1.critical? || result2.critical?
                            Result.critical(text)
                          elsif result1.success? || result2.success?
                            Result.success(text)
                  Severity: Minor
                  Found in lib/bcdice/game_system/AssaultEngine.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 parse_2r6 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def parse_2r6(string)
                          m = /^2R6m\[([-+]?\d+(?:[-+]\d+)*)(?:,([-+]?\d+(?:[-+]\d+)*))?\](?:c\[(\d+(?:,\d+)*)\])?(?:f\[(\d+(?:,\d+)*)\])?(?:([>=]+)(\d+))?/i.match(string)
                          unless m
                            return nil
                          end
                  Severity: Minor
                  Found in lib/bcdice/game_system/NightWizard.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 eval_game_system_specific_command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def eval_game_system_specific_command(command)
                          cmd = Command::Parser.new(/AES?/, round_type: round_type).enable_prefix_number
                                               .has_suffix_number.parse(command)
                          return nil unless cmd
                  
                  
                  Severity: Minor
                  Found in lib/bcdice/game_system/AssaultEngine.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def roll(randomizer)
                            dice = randomizer.roll_once(@items.length)
                            chosen = @items[dice - 1]
                  
                            critical = chosen == CRITICAL
                  Severity: Minor
                  Found in lib/bcdice/game_system/KamitsubakiCityUnderConstructionNarrative.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

                  Severity
                  Category
                  Status
                  Source
                  Language