cloudfoundry/cloud_controller_ng

View on GitHub
app/actions/service_credential_binding_key_create.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method precursor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def precursor(service_instance, message:)
        validate_service_instance!(service_instance)
        key = ServiceKey.first(service_instance: service_instance, name: message.name)
        validate_key!(key, message.name)

Severity: Minor
Found in app/actions/service_credential_binding_key_create.rb - About 1 hr to fix

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

          def validate_service_instance!(service_instance)
            if service_instance.managed_instance?
              service_not_bindable! unless service_instance.service_plan.bindable?
              service_instance_not_found! if service_instance.create_failed?
              operation_in_progress! if service_instance.operation_in_progress?
    Severity: Minor
    Found in app/actions/service_credential_binding_key_create.rb - About 55 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_key! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def validate_key!(key, message_name)
            return unless key
    
            key_already_exists!(message_name) if key.create_succeeded? || key.create_in_progress?
            key_incomplete_deletion!(message_name) if key.delete_failed? || key.delete_in_progress?
    Severity: Minor
    Found in app/actions/service_credential_binding_key_create.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