mongodb/mongo-ruby-driver

View on GitHub
lib/mongo/crypt/handle.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method set_crypto_hooks has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def set_crypto_hooks
        @aes_encrypt = Proc.new do |_, key_binary_p, iv_binary_p, input_binary_p,
          output_binary_p, response_length_p, status_p|
          do_aes(
            key_binary_p,
Severity: Major
Found in lib/mongo/crypt/handle.rb - About 2 hrs to fix

    Method set_kms_providers_aws has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

          def set_kms_providers_aws(kms_providers)
            unless kms_providers[:aws]
              raise ArgumentError.new('The :aws KMS provider must not be nil')
            end
    
    
    Severity: Minor
    Found in lib/mongo/crypt/handle.rb - About 1 hr 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 set_kms_providers_aws has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def set_kms_providers_aws(kms_providers)
            unless kms_providers[:aws]
              raise ArgumentError.new('The :aws KMS provider must not be nil')
            end
    
    
    Severity: Minor
    Found in lib/mongo/crypt/handle.rb - About 1 hr to fix

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

            def do_aes(key_binary_p, iv_binary_p, input_binary_p, output_binary_p,
              response_length_p, status_p, decrypt: false)
      Severity: Minor
      Found in lib/mongo/crypt/handle.rb - About 45 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 set_kms_providers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def set_kms_providers(kms_providers)
                  unless kms_providers
                    raise ArgumentError.new("The kms_providers option must not be nil")
                  end
          
          
          Severity: Minor
          Found in lib/mongo/crypt/handle.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

          There are no issues that match your filters.

          Category
          Status