cloudfoundry/cloud_controller_ng

View on GitHub
lib/cloud_controller/validate_database_keys.rb

Summary

Maintainability
A
1 hr
Test Coverage

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

      def validate_encryption_key_values_unchanged!(config)
        encryption_key_labels = config.get(:database_encryption, :keys)
        return if encryption_key_labels.blank?

        labels_with_changed_keys = []
Severity: Minor
Found in lib/cloud_controller/validate_database_keys.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 can_decrypt_all_rows! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def can_decrypt_all_rows!(config)
        # Terminology: a present string has at least one char (so the nil value is not present)
        #              a blank string is the opposite of a present string
        # Note: String#blank? is true for non-empty strings containing only whitespace characters.
        # It's *possible* for an encryption key to fit this property but very bad form, so we don't worry about it.
Severity: Minor
Found in lib/cloud_controller/validate_database_keys.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