mongodb/mongo-ruby-driver

View on GitHub

Showing 423 of 480 total issues

Method run! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def run!
      if @stop_requested && @thread
        wait_for_stop
        if @thread.alive?
          log_warn("Starting a new background thread in #{self}, but the previous background thread is still running")
Severity: Minor
Found in lib/mongo/background_thread.rb - About 25 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 load_private_key has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def load_private_key(text, passphrase)
        args = if passphrase
          [text, passphrase]
        else
          [text]
Severity: Minor
Found in lib/mongo/socket/ssl.rb - About 25 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 to_document has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def to_document
            BSON::Document.new({
              provider: 'kmip',
            }).tap do |bson|
              bson.update({ endpoint: endpoint }) unless endpoint.nil?
Severity: Minor
Found in lib/mongo/crypt/kms/kmip/master_document.rb - About 25 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