mongodb/mongo-ruby-driver

View on GitHub

Showing 423 of 480 total issues

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

    def initialize(address, cluster, monitoring, event_listeners, options = {})
      @address = address
      @cluster = cluster
      @monitoring = monitoring
      options = options.dup
Severity: Minor
Found in lib/mongo/server.rb - About 1 hr to fix

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

                  def insert_one(document, opts = {})
                    QueryCache.clear_namespace(namespace)
              
                    client.with_session(opts) do |session|
                      write_concern = if opts[:write_concern]
              Severity: Minor
              Found in lib/mongo/collection.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 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 initialize has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def initialize(view, result, server, options = {})
                          unless result.is_a?(Operation::Result)
                            raise ArgumentError, "Second argument must be a Mongo::Operation::Result: #{result.inspect}"
                          end
                    
                    
                    Severity: Minor
                    Found in lib/mongo/cursor.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 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 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 initialize has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

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

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

                                    def create_many(*models)
                                      models = models.flatten
                                      options = {}
                                      if models && !models.last.key?(:key)
                                        options = models.pop
                              Severity: Minor
                              Found in lib/mongo/index/view.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 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 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 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

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

                                              def do_clear(options = nil)
                                                check_invariants
                                        
                                                service_id = options && options[:service_id]
                                        
                                        
                                        Severity: Minor
                                        Found in lib/mongo/server/connection_pool.rb - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language