mongodb/mongo-ruby-driver

View on GitHub
lib/mongo/socket/ocsp_verifier.rb

Summary

Maintainability
D
1 day
Test Coverage

Method verify_one_responder has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

      def verify_one_responder(uri)
        original_uri = uri
        redirect_count = 0
        http_response = nil
        loop do
Severity: Minor
Found in lib/mongo/socket/ocsp_verifier.rb - About 6 hrs 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 verify_one_responder has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def verify_one_responder(uri)
        original_uri = uri
        redirect_count = 0
        http_response = nil
        loop do
Severity: Major
Found in lib/mongo/socket/ocsp_verifier.rb - About 3 hrs to fix

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

          def initialize(host_name, cert, ca_cert, cert_store, **opts)
    Severity: Minor
    Found in lib/mongo/socket/ocsp_verifier.rb - About 35 mins to fix

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

            def return_ocsp_response(resp, errors = nil)
              if resp
                if resp.cert_status == OpenSSL::OCSP::V_CERTSTATUS_REVOKED
                  raise_revoked_error(resp)
                end
      Severity: Minor
      Found in lib/mongo/socket/ocsp_verifier.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

      Avoid too many return statements within this method.
      Open

                return false
      Severity: Major
      Found in lib/mongo/socket/ocsp_verifier.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                  return false
        Severity: Major
        Found in lib/mongo/socket/ocsp_verifier.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                    return false
          Severity: Major
          Found in lib/mongo/socket/ocsp_verifier.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                      return false
            Severity: Major
            Found in lib/mongo/socket/ocsp_verifier.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                        return false
              Severity: Major
              Found in lib/mongo/socket/ocsp_verifier.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                          return false
                Severity: Major
                Found in lib/mongo/socket/ocsp_verifier.rb - About 30 mins to fix

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

                        def verify_with_cache
                          handle_exceptions do
                            return false if ocsp_uris.empty?
                  
                            resp = OcspCache.get(cert_id)
                  Severity: Minor
                  Found in lib/mongo/socket/ocsp_verifier.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

                  There are no issues that match your filters.

                  Category
                  Status