bcdice/BCDice

View on GitHub

Showing 1,217 of 1,274 total issues

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

      def eval_game_system_specific_command(command)
        if command =~ /(-)?(\d+)?RD(\d+)?(@(\d+))?$/i
          diceCount = (Regexp.last_match(2) || 1).to_i
          diceCount *= -1 unless Regexp.last_match(1).nil?
          choiceCount = (Regexp.last_match(3) || 1).to_i
Severity: Minor
Found in lib/bcdice/game_system/Raisondetre.rb - About 2 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 getTotalResult has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

      def getTotalResult(bitList, successList, countOneList, targetNumber, isStop, canReRoll)
        success = successList.inject { |sum, i| sum + i }
        countOne = countOneList.inject { |sum, i| sum + i }

        result = ""
Severity: Minor
Found in lib/bcdice/game_system/BlindMythos.rb - About 2 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 GranCrest.rb has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    File game_system.rb has 266 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "bcdice/game_system/AFF2e"
    require "bcdice/game_system/AceKillerGene"
    require "bcdice/game_system/Ainecadette"
    require "bcdice/game_system/Airgetlamh"
    require "bcdice/game_system/AlchemiaStruggle"
    Severity: Minor
    Found in lib/bcdice/game_system.rb - About 2 hrs to fix

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

            def rollStep(diceType, diceCount)
              debug('rollStep diceType, diceCount, @string', diceType, diceCount, @string)
      
              stepTotal = 0
              return stepTotal unless diceCount > 0
      Severity: Major
      Found in lib/bcdice/game_system/EarthDawn.rb and 2 other locations - About 2 hrs to fix
      lib/bcdice/game_system/EarthDawn3.rb on lines 236..271
      lib/bcdice/game_system/EarthDawn4.rb on lines 233..268

      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 88.

      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 3 locations. Consider refactoring.
      Open

            def rollStep(diceType, diceCount)
              debug('rollStep diceType, diceCount, @string', diceType, diceCount, @string)
      
              stepTotal = 0
              return stepTotal unless diceCount > 0
      Severity: Major
      Found in lib/bcdice/game_system/EarthDawn3.rb and 2 other locations - About 2 hrs to fix
      lib/bcdice/game_system/EarthDawn.rb on lines 186..221
      lib/bcdice/game_system/EarthDawn4.rb on lines 233..268

      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 88.

      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 3 locations. Consider refactoring.
      Open

            def rollStep(diceType, diceCount)
              debug('rollStep diceType, diceCount, @calcText', diceType, diceCount, @calcText)
      
              stepTotal = 0
              return stepTotal unless diceCount > 0
      Severity: Major
      Found in lib/bcdice/game_system/EarthDawn4.rb and 2 other locations - About 2 hrs to fix
      lib/bcdice/game_system/EarthDawn.rb on lines 186..221
      lib/bcdice/game_system/EarthDawn3.rb on lines 236..271

      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 88.

      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 roll_amadeus has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def roll_amadeus(command)
              m = /^R([A-DS])([+\-\d]*)(@(\d))?((>=?)([+\-\d]*))?(@(\d))?$/i.match(command)
              unless m
                return nil
              end
      Severity: Major
      Found in lib/bcdice/game_system/Amadeus.rb - About 2 hrs to fix

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

              class DeathChart
                def initialize(name, chart)
                  @name = name
                  @chart = chart.freeze
        
        
        Severity: Major
        Found in lib/bcdice/game_system/BlackJacket.rb and 1 other location - About 2 hrs to fix
        lib/bcdice/game_system/DeadlineHeroes.rb on lines 116..148

        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 87.

        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

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

              class DeathChart
                def initialize(name, chart)
                  @name = name
                  @chart = chart.freeze
        
        
        Severity: Major
        Found in lib/bcdice/game_system/DeadlineHeroes.rb and 1 other location - About 2 hrs to fix
        lib/bcdice/game_system/BlackJacket.rb on lines 103..135

        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 87.

        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 ability_roll has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def ability_roll(command)
                m = /^AR([-+]\d+)?(>=(\d+))?([AD]?)/.match(command)
                unless m
                  return nil
                end
        Severity: Major
        Found in lib/bcdice/game_system/DungeonsAndDragons5.rb - About 2 hrs to fix

          Method check_roll_loop has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

                def check_roll_loop(roll_times, min_suc, target, critical, fumble, is_critical_stop)
                  dice_str = ''
                  is_fumble = false
                  is_critical = false
                  total_suc = 0
          Severity: Minor
          Found in lib/bcdice/game_system/Satasupe.rb - About 2 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_judge has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

                def roll_judge(command)
                  m = /^TN(6|10)([CSBYA]*)$/.match(command)
                  unless m
                    return nil
                  end
          Severity: Minor
          Found in lib/bcdice/game_system/TensaiGunshiNiNaro.rb - About 2 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 resolute_attacking has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

                def resolute_attacking(command)
                  m = /^([-+]\d+)?AA<=(\d+)$/.match(command)
                  return nil unless m
          
                  num_bonus = m[1].to_i
          Severity: Minor
          Found in lib/bcdice/game_system/AniMalus.rb - About 2 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 eval_game_system_specific_command has 56 lines of code (exceeds 25 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: Major
          Found in lib/bcdice/game_system/WorldOfDarkness.rb - About 2 hrs to fix

            File RuinBreakers.rb has 258 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'bcdice/arithmetic_evaluator'
            require 'bcdice/dice_table/table'
            require 'bcdice/dice_table/range_table'
            
            module BCDice
            Severity: Minor
            Found in lib/bcdice/game_system/RuinBreakers.rb - About 2 hrs to fix

              Class Cthulhu7th_Korean has 21 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class Cthulhu7th_Korean < Base
                    # ゲームシステムの識別子
                    ID = 'Cthulhu7th:Korean'
              
                    # ゲームシステム名
              Severity: Minor
              Found in lib/bcdice/game_system/Cthulhu7th_Korean.rb - About 2 hrs to fix

                Class Cthulhu7th_ChineseTraditional has 21 methods (exceeds 20 allowed). Consider refactoring.
                Open

                    class Cthulhu7th_ChineseTraditional < Base
                      # ゲームシステムの識別子
                      ID = 'Cthulhu7th:ChineseTraditional'
                
                      # ゲームシステム名
                Severity: Minor
                Found in lib/bcdice/game_system/Cthulhu7th_ChineseTraditional.rb - About 2 hrs to fix

                  Method getStructureEncounter has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def getStructureEncounter(number)
                          debug("getStructureEncounter number", number)
                  
                          tables = [[1, ['船から降りてきた', '魚を売っている', '仕事で忙しそうな', '異国から来た', 'おもしろおかしい', '汗水流している']],
                                    [2, ['おかしな格好をした', '歌を歌っている', 'ステキな笑顔をした', '日なたぼっこをしている', '悩んでいる', '旅をしている']],
                  Severity: Major
                  Found in lib/bcdice/game_system/WitchQuest.rb - About 2 hrs to fix

                    Method roll_judge has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def roll_judge(command)
                            m = /^TN(6|10)([CSBYA]*)$/.match(command)
                            unless m
                              return nil
                            end
                    Severity: Major
                    Found in lib/bcdice/game_system/TensaiGunshiNiNaro.rb - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language