mongodb/mongo-ruby-driver

View on GitHub

Showing 227 of 284 total issues

Method command_completed has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def command_completed(result, address, operation_id, payload, duration)
Severity: Minor
Found in lib/mongo/monitoring/publishable.rb - About 35 mins to fix

    Method command_succeeded has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def command_succeeded(result, address, operation_id, payload, duration)
    Severity: Minor
    Found in lib/mongo/monitoring/publishable.rb - About 35 mins to fix

      Method insert_one has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def insert_one(documents, server, operation_id, session, txn_num)
      Severity: Minor
      Found in lib/mongo/bulk_write.rb - About 35 mins to fix

        Method delete_many has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def delete_many(documents, server, operation_id, session, txn_num)
        Severity: Minor
        Found in lib/mongo/bulk_write.rb - About 35 mins to fix

          Method update_one has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def update_one(documents, server, operation_id, session, txn_num)
          Severity: Minor
          Found in lib/mongo/bulk_write.rb - About 35 mins to fix

            Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def initialize(database, collection, selector, update, options = {})
            Severity: Minor
            Found in lib/mongo/protocol/update.rb - About 35 mins to fix

              Method update_many has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def update_many(documents, server, operation_id, session, txn_num)
              Severity: Minor
              Found in lib/mongo/bulk_write.rb - About 35 mins to fix

                Method delete_one has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def delete_one(documents, server, operation_id, session, txn_num)
                Severity: Minor
                Found in lib/mongo/bulk_write.rb - About 35 mins to fix

                  Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                        def initialize(host, port, timeout, family, options = {})
                  Severity: Minor
                  Found in lib/mongo/socket/tcp.rb - About 35 mins to fix

                    Method do_hmac_sha has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                          def do_hmac_sha(digest_name, key_binary_p, input_binary_p,
                            output_binary_p, status_p)
                    Severity: Minor
                    Found in lib/mongo/crypt/handle.rb - About 35 mins to fix

                      Method serialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def serialize(message, client, buffer = BSON::ByteBuffer.new)
                              start_size = 0
                              final_message = message.maybe_compress(compressor, options[:zlib_compression_level])
                      
                              # Driver specifications only mandate the fixed 16MiB limit for
                      Severity: Minor
                      Found in lib/mongo/server/connection_base.rb - About 35 mins 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 count has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def count(opts = {})
                                cmd = { :count => collection.name, :query => filter }
                                cmd[:skip] = opts[:skip] if opts[:skip]
                                cmd[:hint] = opts[:hint] if opts[:hint]
                                cmd[:limit] = opts[:limit] if opts[:limit]
                      Severity: Minor
                      Found in lib/mongo/collection/view/readable.rb - About 35 mins 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 server_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def server_type
                              return :arbiter if arbiter?
                              return :ghost if ghost?
                              return :sharded if mongos?
                              return :primary if primary?
                      Severity: Minor
                      Found in lib/mongo/server/description.rb - About 35 mins 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 document has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def document
                              client_document = full_client_document
                              while client_document.to_bson.to_s.size > MAX_DOCUMENT_SIZE do
                                if client_document[:os][:name] || client_document[:os][:architecture]
                                  client_document[:os].delete(:name)
                      Severity: Minor
                      Found in lib/mongo/server/app_metadata.rb - About 35 mins 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 process has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def process(result)
                            @remaining -= result.returned_count if limited?
                            @coll_name ||= result.namespace.sub("#{database.name}.", '') if result.namespace
                            # #process is called for the first batch of results. In this case
                            # the @cursor_id may be zero (all results fit in the first batch).
                      Severity: Minor
                      Found in lib/mongo/cursor.rb - About 35 mins 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 generate_reply has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def self.generate_reply(command_payload, reply_payload)
                                if reply_payload
                                  reply = reply_payload[:reply]
                                  if cursor = reply[:cursor]
                                    if !cursor.key?(Collection::NS)
                      Severity: Minor
                      Found in lib/mongo/monitoring/event/command_succeeded.rb - About 35 mins 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 update_rs_with_primary_from_member has a Cognitive Complexity of 7 (exceeds 5 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 35 mins 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 max_staleness has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def max_staleness(value)
                            if /\A-?\d+\z/ =~ value
                              int = value.to_i
                      
                              if int == -1
                      Severity: Minor
                      Found in lib/mongo/uri.rb - About 35 mins 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 authenticate! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def authenticate!(pending_connection)
                              if options[:user] || options[:auth_mech]
                                user_options = Options::Redacted.new(:auth_mech => default_mechanism).merge(options)
                                if user_options[:auth_mech] == :mongodb_x509
                                  user_options[:auth_source] = '$external'
                      Severity: Minor
                      Found in lib/mongo/server/connection.rb - About 35 mins 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 remove_servers_not_in_desc has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def remove_servers_not_in_desc(updated_desc)
                            updated_desc_address_strs = %w(hosts passives arbiters).map do |m|
                              updated_desc.send(m)
                            end.flatten
                            servers_list.each do |server|
                      Severity: Minor
                      Found in lib/mongo/cluster/sdam_flow.rb - About 35 mins 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

                      Severity
                      Category
                      Status
                      Source
                      Language