bcdice/BCDice

View on GitHub

Showing 809 of 1,233 total issues

Method get_roll_result has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

      def get_roll_result(result_text, success_dice, ten_dice, _desperaton_ten_dice, desperaton_botch_dice, difficulty)
        result_text = "#{result_text} 成功数=#{success_dice}"
        is_critical = ten_dice >= 2
        desperation_result = ""

Severity: Minor
Found in lib/bcdice/game_system/HunterTheReckoning5th.rb - About 4 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 KemonoNoMori.rb has 353 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'bcdice/dice_table/table'
require 'bcdice/dice_table/range_table'

module BCDice
  module GameSystem
Severity: Minor
Found in lib/bcdice/game_system/KemonoNoMori.rb - About 4 hrs to fix

    File KillDeathBusiness.rb has 352 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      File node.rb has 352 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require "singleton"
      
      module BCDice
        module CommonCommand
          module AddDice
      Severity: Minor
      Found in lib/bcdice/common_command/add_dice/node.rb - About 4 hrs to fix

        File event_tables.rb has 350 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module BCDice
          module GameSystem
            class FilledWith
              class EventTable
                def initialize(area_name, area_id, rows)
        Severity: Minor
        Found in lib/bcdice/game_system/filled_with/event_tables.rb - About 4 hrs to fix

          File item_table.rb has 349 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module BCDice
            module GameSystem
              class MeikyuKingdomBasic
                WEAPON_ITEM_TABLE = DiceTable::D66Table.new(
                  "武具アイテム表",
          Severity: Minor
          Found in lib/bcdice/game_system/meikyu_kingdom_basic/item_table.rb - About 4 hrs to fix

            Method getCriticalResult has 109 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def getCriticalResult(string)
                    # クリティカル効果データ
                    whh = [
                      '01:打撃で状況が把握出来なくなる。次ターンは1回の半アクションしか行なえない。',
                      '02:耳を強打された為、耳鳴りが酷く目眩がする。1Rに渡って一切のアクションを行なえない。',
            Severity: Major
            Found in lib/bcdice/game_system/Warhammer.rb - About 4 hrs to fix

              Class Base has 34 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class Base
                  class << self
                    # 接頭辞(反応するコマンド)の配列を返す
                    # @return [Array<String>]
                    attr_reader :prefixes
              Severity: Minor
              Found in lib/bcdice/base.rb - About 4 hrs to fix

                Method attack_roll has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                      def attack_roll(command)
                        m = /^AT([-+]\d+)?(@(\d+))?(>=(\d+))?([AD]?)/.match(command)
                        unless m
                          return nil
                        end
                Severity: Minor
                Found in lib/bcdice/game_system/DungeonsAndDragons5.rb - About 4 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 get_roll_result has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                      def get_roll_result(result_text, success_dice, ten_dice, hunger_ten_dice, hunger_botch_dice, difficulty)
                        result_text = "#{result_text} 成功数=#{success_dice}"
                        is_critical = ten_dice >= 2
                
                        if difficulty > 0
                Severity: Minor
                Found in lib/bcdice/game_system/VampireTheMasquerade5th.rb - About 4 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 getTresureTable has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def getTresureTable(num)
                        case num
                          # 初級マイナス
                        when -1
                          table = [
                Severity: Major
                Found in lib/bcdice/game_system/GurpsFW.rb - About 4 hrs to fix

                  Method getSW2_0_RatingTable has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def getSW2_0_RatingTable
                          rate_sw2_0 = [
                            # 0
                            '*,0,0,0,1,2,2,3,3,4,4',
                            '*,0,0,0,1,2,3,3,3,4,4',
                  Severity: Major
                  Found in lib/bcdice/game_system/SwordWorld.rb - About 4 hrs to fix

                    File item_table.rb has 336 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    module BCDice
                      module GameSystem
                        class MeikyuKingdom
                          # デバイスファクトリー(1D6)
                          def mk_device_factory_table()
                    Severity: Minor
                    Found in lib/bcdice/game_system/meikyu_kingdom/item_table.rb - About 4 hrs to fix

                      File StellarLife.rb has 332 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

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

                        Method getDamageTypeAndTable has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              def getDamageTypeAndTable(head)
                                case head
                                when "S"
                                  type = '射撃'
                                  # 射撃ダメージペナルティー表
                        Severity: Major
                        Found in lib/bcdice/game_system/GundogRevised.rb - About 3 hrs to fix

                          Method getDamageTypeAndTable has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                def getDamageTypeAndTable(head)
                                  case head
                                  when "S"
                                    type = '射撃'
                                    # 射撃ダメージペナルティー表
                          Severity: Major
                          Found in lib/bcdice/game_system/GundogZero.rb - About 3 hrs to fix

                            Method get_roll_result has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                            Open

                                  def get_roll_result(result_text, success_dice, ten_dice, _rage_ten_dice, brutal_outcome, difficulty)
                                    is_critical = ten_dice >= 2
                            
                                    if brutal_outcome > 0 && difficulty != 0
                                      success_dice += 4
                            Severity: Minor
                            Found in lib/bcdice/game_system/WerewolfTheApocalypse5th.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 eval_game_system_specific_command has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  def eval_game_system_specific_command(string)
                                    if /^\d+D\d+/i.match?(string)
                                      return roll_action(string)
                                    end
                            
                            
                            Severity: Major
                            Found in lib/bcdice/game_system/TunnelsAndTrolls.rb - About 3 hrs to fix

                              Method wh_atpos has 93 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                    def wh_atpos(pos_num, pos_type) # WHFRP2命中部位表
                                      debug("wh_atpos begin pos_type", pos_type)
                                      pos_2l = [
                                        '二足',
                                        15, '頭部',
                              Severity: Major
                              Found in lib/bcdice/game_system/Warhammer.rb - About 3 hrs to fix

                                File GURPS.rb has 321 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

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