bcdice/BCDice

View on GitHub

Showing 1,176 of 1,233 total issues

Method get_damageEffect_table has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def get_damageEffect_table(hitPart, damageStage)
        damageInfos = [['L', '(LW)'],
                       ['M', '(MW)'],
                       ['H', '(HW)'],
                       ['O', '(MO)']]
Severity: Major
Found in lib/bcdice/game_system/MetalHeadExtream.rb - About 3 hrs to fix

    Method check_action has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

          def check_action(command)
            parser = Command::Parser.new("AB", round_type: RoundType::CEIL).has_prefix_number.enable_critical.enable_dollar.restrict_cmp_op_to(nil, :>=)
            parsed = parser.parse(command)
            return nil if parsed.nil?
    
    
    Severity: Minor
    Found in lib/bcdice/game_system/Ayabito.rb - About 3 hrs 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 rating has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

          def rating(string) # レーティング表
            debug("rating string", string)
            command = rating_parser.parse(string)
    
            unless command
    Severity: Minor
    Found in lib/bcdice/game_system/SwordWorld.rb - About 3 hrs 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 ability_roll has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

          def ability_roll(command)
            m = /^AR([-+]\d+)?(>=(\d+))?([AD]?)/.match(command)
            unless m
              return nil
            end
    Severity: Minor
    Found in lib/bcdice/game_system/DungeonsAndDragons5.rb - About 3 hrs 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 getStepResult has 85 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def getStepResult(str)
            return nil unless /(\d+)E(\d+)?(\+)?(\d+)?(d\d+)?/i =~ str
    
            stepTotal = 0
            @isFailed = true
    Severity: Major
    Found in lib/bcdice/game_system/EarthDawn.rb - About 3 hrs to fix

      File SwordWorld.rb has 307 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require "bcdice/base"
      require "bcdice/game_system/sword_world/rating_parser"
      
      module BCDice
        module GameSystem
      Severity: Minor
      Found in lib/bcdice/game_system/SwordWorld.rb - About 3 hrs to fix

        File AlchemiaStruggle.rb has 305 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require "bcdice/base"
        
        module BCDice
          module GameSystem
            class AlchemiaStruggle < Base
        Severity: Minor
        Found in lib/bcdice/game_system/AlchemiaStruggle.rb - About 3 hrs to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                def mk_rare_item_table(num)
                  table = [
                    [11, "ブルーリボン"],
                    [12, "聖痕"],
                    [13, "剥製"],
          Severity: Major
          Found in lib/bcdice/game_system/meikyu_kingdom/item_table.rb and 1 other location - About 3 hrs to fix
          lib/bcdice/game_system/meikyu_kingdom/item_table.rb on lines 145..185

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 116.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                def mk_rare_weapon_item_table(num)
                  table = [
                    [11, "虚弾"],
                    [12, "怪物毒"],
                    [13, "小鬼の襟巻"],
          Severity: Major
          Found in lib/bcdice/game_system/meikyu_kingdom/item_table.rb and 1 other location - About 3 hrs to fix
          lib/bcdice/game_system/meikyu_kingdom/item_table.rb on lines 189..229

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 116.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Method eval_game_system_specific_command has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

                def eval_game_system_specific_command(command)
                  difficulty = 6
                  auto_success = 0
                  enabled_reroll = false
                  enabled_reroll_with_botch = false
          Severity: Minor
          Found in lib/bcdice/game_system/WorldOfDarkness.rb - About 3 hrs 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 use_edible_plant_chart has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

                def use_edible_plant_chart(command)
                  match_data = command.match(/EP([VA]?)(\d?)/)
                  chart_symbol = match_data[1] == '' ? 'V' : match_data[1]
          
                  case chart_symbol
          Severity: Minor
          Found in lib/bcdice/game_system/Villaciel.rb - About 3 hrs 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_check has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

                def roll_check(command)
                  m = /^KS(?:\(([-+\d]+),([-+\d]+)?\)|(\d+))([AD]?)(?:>=([-+\d]+))?$/.match(command)
                  return nil unless m
          
                  dice_size = m[1] ? Arithmetic.eval(m[1], @round_type) : Arithmetic.eval(m[3], @round_type).to_i
          Severity: Minor
          Found in lib/bcdice/game_system/KyokoShinshoku.rb - About 3 hrs 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 fate_monster has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

                def fate_monster(_natural_result, order)
                  modified_result = []
                  if order.length > 9 && order[2] =~ /^\d+$/ && order[3] =~ /^\d+$/ && order[4] =~ /^\d+$/ && order[5] =~ /^\d+$/ && order[6] =~ /^\d+$/ && order[7] =~ /^\d+$/ && order[8] =~ /^\d+$/ && order[9] =~ /^\d+$/
                    if order[2].to_i > 0
                      modified_result.concat(@randomizer.roll_barabara(order[2].to_i, 2))
          Severity: Minor
          Found in lib/bcdice/game_system/HeroScale.rb - About 3 hrs 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 getStepResult has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

                def getStepResult(str)
                  return nil unless /(\d+)E(\d+)?(\+)?(\d+)?(d\d+)?/i =~ str
          
                  stepTotal = 0
                  @isFailed = true
          Severity: Minor
          Found in lib/bcdice/game_system/EarthDawn.rb - About 3 hrs 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

          File FilledWith.rb has 300 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module BCDice
            module GameSystem
              class FilledWith < Base
                # ゲームシステムの識別子
                ID = 'FilledWith'
          Severity: Minor
          Found in lib/bcdice/game_system/FilledWith.rb - About 3 hrs to fix

            Method resolute_action has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

                  def resolute_action(command)
                    m = /^(\d*)([+\d]+)*FF<=(\d)(,(\d))?(&(\d))?$/.match(command)
                    return nil unless m
            
                    heat_level = m[1].to_i
            Severity: Minor
            Found in lib/bcdice/game_system/FullFace.rb - About 3 hrs 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

            File LiveraDoll.rb has 293 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module BCDice
              module GameSystem
                class LiveraDoll < Base
                  # ゲームシステムの識別子
                  ID = 'LiveraDoll'
            Severity: Minor
            Found in lib/bcdice/game_system/LiveraDoll.rb - About 3 hrs to fix

              File BeastBindTrinity.rb has 293 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'bcdice/arithmetic_evaluator'
              require 'bcdice/format'
              require 'bcdice/normalize'
              require 'bcdice/dice_table/table'
              require 'bcdice/dice_table/d66_grid_table'
              Severity: Minor
              Found in lib/bcdice/game_system/BeastBindTrinity.rb - About 3 hrs to fix

                File Warhammer.rb has 292 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                module BCDice
                  module GameSystem
                    class Warhammer < Base
                      # ゲームシステムの識別子
                      ID = 'Warhammer'
                Severity: Minor
                Found in lib/bcdice/game_system/Warhammer.rb - About 3 hrs to fix

                  Method getFumbleTypeAndTable has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def getFumbleTypeAndTable(head)
                          case head
                          when "S"
                            type = '射撃'
                            # 射撃ファンブル表
                  Severity: Major
                  Found in lib/bcdice/game_system/GundogRevised.rb - About 3 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language