mongodb/mongo-ruby-driver

View on GitHub

Showing 163 of 216 total issues

Method command_failed has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def command_failed(failure, address, operation_id, payload, message, duration)
Severity: Minor
Found in lib/mongo/monitoring/publishable.rb - About 45 mins to fix

    Method process_result has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def process_result(result, server)
            server.update_cluster_time(result)
    
            if result.not_master? || result.node_recovering?
              if result.node_shutting_down?
    Severity: Minor
    Found in lib/mongo/operation/shared/executable.rb - About 45 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 ismaster has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def ismaster
            @mutex.synchronize do
              if monitoring.monitoring?
                monitoring.started(
                  Monitoring::SERVER_HEARTBEAT,
    Severity: Minor
    Found in lib/mongo/server/monitor.rb - About 45 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 retry_write_allowed? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def retry_write_allowed?(session, write_concern)
          unless session && session.retry_writes?
            return false
          end
    
    
    Severity: Minor
    Found in lib/mongo/retryable.rb - About 45 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 validate_read_concern_option has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_read_concern_option(read_concern)
          return unless enabled?
          return if read_concern.nil?
          unless read_concern.is_a?(Hash)
            raise Error::LintError, "Read concern is not a hash: #{read_concern}"
    Severity: Minor
    Found in lib/mongo/lint.rb - About 45 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 aggregate_write_errors has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def aggregate_write_errors(count)
              return unless @replies
              @replies.reduce(nil) do |errors, reply|
                if write_errors = reply.documents.first[Error::WRITE_ERRORS]
                  wes = write_errors.collect do |we|
    Severity: Minor
    Found in lib/mongo/operation/shared/result/aggregatable.rb - About 45 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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

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

      Method find_command has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def find_command
                document = BSON::Document.new
                document.store(FIND, collection)
                document.store(FILTER, query_filter)
                OPTION_MAPPINGS.each do |legacy, option|
      Severity: Minor
      Found in lib/mongo/protocol/query.rb - About 45 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 has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def self.generate(address, operation_id, command_payload, reply_payload, duration)
      Severity: Minor
      Found in lib/mongo/monitoring/event/command_succeeded.rb - About 35 mins to fix

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

            def initialize(address, cluster, monitoring, event_listeners, options = {})
        Severity: Minor
        Found in lib/mongo/server.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 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_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 finalize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def self.finalize(cursor_id, cluster, op_spec, server, session)
                Severity: Minor
                Found in lib/mongo/cursor.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 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 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 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(host, port, timeout, family, options = {})
                          Severity: Minor
                          Found in lib/mongo/socket/tcp.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
                              Severity
                              Category
                              Status
                              Source
                              Language