mongodb/mongo-ruby-driver

View on GitHub

Showing 393 of 447 total issues

Method initial has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def initial(cluster, monitoring, options)
        connect = options[:connect]&.to_sym
        cls = if options[:direct_connection]
          if connect && connect != :direct
            raise ArgumentError, "Conflicting topology options: direct_connection=true and connect=#{connect}"
Severity: Minor
Found in lib/mongo/cluster/topology.rb - About 1 hr to fix

    Method create_and_add_connection has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def create_and_add_connection
            connection = nil
    
            @lock.synchronize do
              if !closed? && @ready &&
    Severity: Minor
    Found in lib/mongo/server/connection_pool.rb - About 1 hr to fix

      Method close has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def close
            @state_change_lock.synchronize do
              unless connecting? || connected?
                return nil
              end
      Severity: Minor
      Found in lib/mongo/cluster.rb - About 1 hr to fix

        Method get_connection has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def get_connection(pid, connection_global_id)
                if connection = next_available_connection(connection_global_id)
                  unless valid_available_connection?(connection, pid, connection_global_id)
                    return nil
                  end
        Severity: Minor
        Found in lib/mongo/server/connection_pool.rb - About 1 hr to fix

          Method change_doc has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def change_doc
                    {}.tap do |doc|
                      if @options[:full_document]
                        doc[:fullDocument] = @options[:full_document]
                      end
          Severity: Minor
          Found in lib/mongo/collection/view/change_stream.rb - About 1 hr to fix

            Method delete_many has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def delete_many(opts = {})
                      with_session(opts) do |session|
                        write_concern = if opts[:write_concern]
                          WriteConcern.get(opts[:write_concern])
                        else
            Severity: Minor
            Found in lib/mongo/collection/view/writable.rb - About 1 hr to fix

              Method initialize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def initialize(flags, options, main_document, *sequences)
                      if flags
                        flags.each do |flag|
                          unless KNOWN_FLAGS.key?(flag)
                            raise ArgumentError, "Unknown flag: #{flag.inspect}"
              Severity: Minor
              Found in lib/mongo/protocol/msg.rb - About 1 hr to fix

                Method validate_requests! has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def validate_requests!
                      requests_empty = true
                      @requests.each do |req|
                        requests_empty = false
                        if op = req.keys.first
                Severity: Minor
                Found in lib/mongo/bulk_write.rb - About 1 hr to fix

                  Method create has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def create(opts = {})
                        # Passing read options to create command causes it to break.
                        # Filter the read options out. Session is also excluded here as it gets
                        # used by the call to with_session and should not be part of the
                        # operation. If it gets passed to the operation it would fail BSON
                  Severity: Minor
                  Found in lib/mongo/collection.rb - About 1 hr to fix

                    Method update_rs_with_primary_from_member has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def update_rs_with_primary_from_member
                          if topology.replica_set_name != updated_desc.replica_set_name
                            log_warn(
                              "Removing server #{updated_desc.address.to_s} because it has an " +
                              "incorrect replica set name (#{updated_desc.replica_set_name}); " +
                    Severity: Minor
                    Found in lib/mongo/cluster/sdam_flow.rb - About 1 hr to fix

                      Method unknown! has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def unknown!(options = {})
                            pool = pool_internal
                      
                            if load_balancer?
                              # When the client is in load-balanced topology, servers (the one and
                      Severity: Minor
                      Found in lib/mongo/server.rb - About 1 hr to fix

                        Method start_transaction has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def start_transaction(options = nil)
                              check_transactions_supported!
                        
                              if options
                                Lint.validate_read_concern_option(options[:read_concern])
                        Severity: Minor
                        Found in lib/mongo/session.rb - About 1 hr to fix

                          Method initialize has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                def initialize(user, used_mechanism: nil, message: nil,
                                  server: nil, code: nil
                                )
                                  @code = code
                          
                          
                          Severity: Minor
                          Found in lib/mongo/auth.rb - About 1 hr to fix

                            Method spawn_mongocryptd has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  def spawn_mongocryptd
                                    mongocryptd_spawn_args = @options[:mongocryptd_spawn_args]
                                    mongocryptd_spawn_path = @options[:mongocryptd_spawn_path]
                            
                                    unless mongocryptd_spawn_path
                            Severity: Minor
                            Found in lib/mongo/crypt/encryption_io.rb - About 1 hr to fix

                              Method validate_param has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      def validate_param(key, opts, format_hint, required: true)
                                        value = opts.fetch(key)
                                        return nil if value.nil? && !required
                                        if value.nil?
                                          raise ArgumentError.new(
                              Severity: Minor
                              Found in lib/mongo/crypt/kms.rb - About 1 hr to fix

                                Method ruby_to_smc has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                      def ruby_to_smc(opts)
                                        rv = {}
                                        URI_OPTION_MAP.each do |uri_key, spec|
                                          if spec[:group]
                                            v = opts[spec[:group]]
                                Severity: Minor
                                Found in lib/mongo/uri/options_mapper.rb - About 1 hr to fix

                                  Method ruby_to_string has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                        def ruby_to_string(opts)
                                          rv = {}
                                          URI_OPTION_MAP.each do |uri_key, spec|
                                            if spec[:group]
                                              v = opts[spec[:group]]
                                  Severity: Minor
                                  Found in lib/mongo/uri/options_mapper.rb - About 1 hr to fix

                                    Method create_context has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                          def create_context(options)
                                            OpenSSL::SSL::SSLContext.new.tap do |context|
                                              if OpenSSL::SSL.const_defined?(:OP_NO_RENEGOTIATION)
                                                context.options = context.options | OpenSSL::SSL::OP_NO_RENEGOTIATION
                                              end
                                    Severity: Minor
                                    Found in lib/mongo/socket/ssl.rb - About 1 hr to fix

                                      Method initialize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                            def initialize(address, config = {}, average_round_trip_time: nil,
                                              load_balancer: false, force_load_balancer: false
                                            )
                                              @address = address
                                              @config = config
                                      Severity: Minor
                                      Found in lib/mongo/server/description.rb - About 1 hr to fix

                                        Method normalized? has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                          def self.normalized?(string, form = :nfc)
                                            encoding = string.encoding
                                            case encoding
                                            when Encoding::UTF_8
                                              case form
                                        Severity: Minor
                                        Found in lib/mongo/auth/stringprep/unicode_normalize/normalize.rb - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language