cloudfoundry/cloud_controller_ng

View on GitHub

Showing 583 of 2,698 total issues

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

      def self.record_cancel(deployment, droplet, user_audit_info, v3_app_name, space_guid, org_guid)
Severity: Minor
Found in app/repositories/deployment_event_repository.rb - About 45 mins to fix

    Method assign has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def assign(isolation_segment, organizations)
          isolation_segment.db.transaction do
            isolation_segment.lock!(:share)
    
            organizations.sort! { |o1, o2| o1.id <=> o2.id }.each do |org|
    Severity: Minor
    Found in app/actions/isolation_segment_assign.rb - About 45 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 calculate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def calculate
          if process_has_package || process_has_droplet
            return 'FAILED' if package_failed_upload || last_build_failed || last_droplet_failed
            return 'STAGED' if (process_has_droplet || process_has_build) &&
                               build_completed &&
    Severity: Minor
    Found in app/models/runtime/helpers/package_state_calculator.rb - About 45 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 raise_if_cannot_update! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def raise_if_cannot_update!
            error_code = 'ServiceInstanceWithInaccessiblePlanNotUpdateable'.freeze
            update_error = ->(x) { UnprocessableUpdate.new_from_details(error_code, x) }
            return if service_instance.service_plan.active?
            raise update_error.call('parameters') unless message.parameters.nil?
    Severity: Minor
    Found in app/actions/v3/service_instance_update_managed.rb - About 45 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 assign has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def assign(app, droplet)
          unable_to_assign! unless droplet.present? && droplet_associated?(app, droplet)
    
          app.db.transaction do
            app.lock!
    Severity: Minor
    Found in app/actions/app_assign_droplet.rb - About 45 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 map_organization_roles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def map_organization_roles(user_guids, org_id)
          org = Organization.find(id: org_id)
          org_user_guids = subset_of_guids(org.users_dataset, user_guids)
          manager_guids = subset_of_guids(org.managers_dataset, user_guids)
          auditor_guids = subset_of_guids(org.auditors_dataset, user_guids)
    Severity: Minor
    Found in app/collection_transformers/usernames_and_roles_populator.rb - About 45 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 entity_hash has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            def entity_hash(controller, process, opts, depth, parents, orphans=nil)
    Severity: Minor
    Found in app/presenters/v2/process_model_presenter.rb - About 45 mins to fix

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

              def entity_hash(controller, domain, opts, depth, parents, orphans=nil)
      Severity: Minor
      Found in app/presenters/v2/private_domain_presenter.rb - About 45 mins to fix

        Method get_exception_from_errors has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_exception_from_errors(registration)
              errors = registration.errors
              broker = registration.broker
        
              if errors.on(:broker_url) && errors.on(:broker_url).include?(:url)
        Severity: Minor
        Found in app/actions/services/mixins/service_broker_registration_error_parser.rb - About 45 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 costs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def costs
                  cost_result = []
                  if metadata[:costs]
                    validation_errors = JSON::Validator.fully_validate(costs_schema, metadata[:costs])
                    return cost_result unless validation_errors.none?
        Severity: Minor
        Found in app/presenters/v3/service_plan_presenter.rb - About 45 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 add_space_role has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def add_space_role(user_guid, relationship, space_guid)
              space = Space.first(guid: space_guid)
              user = User.first(guid: user_guid)
              user.username = @uaa_username_lookup_client.usernames_for_ids([user.guid])[user.guid] || ''
        
        
        Severity: Minor
        Found in app/controllers/runtime/users_controller.rb - About 45 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 entity_hash has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                def entity_hash(controller, domain, opts, depth, parents, orphans=nil)
        Severity: Minor
        Found in app/presenters/v2/shared_domain_presenter.rb - About 45 mins to fix

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

                  def entity_hash(controller, service_key, opts, depth, parents, orphans=nil)
          Severity: Minor
          Found in app/presenters/v2/service_key_presenter.rb - About 45 mins to fix

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

                    def entity_hash(controller, obj, opts, depth, parents, orphans=nil)
            Severity: Minor
            Found in app/presenters/v2/default_presenter.rb - About 45 mins to fix

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

                      def to_hash(controller, obj, opts, depth, parents, orphans=nil)
              Severity: Minor
              Found in app/presenters/v2/base_presenter.rb - About 45 mins to fix

                Method parsed_yaml has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  def parsed_yaml
                    return @parsed_yaml if @parsed_yaml
                
                    bad_request!('Manifest size is too large. The maximum supported size is 1MB.') if request.body.size > 1.megabyte
                
                
                Severity: Minor
                Found in app/controllers/v3/application_controller.rb - About 45 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 entity_hash has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        def entity_hash(controller, user, opts, depth, parents, orphans=nil)
                Severity: Minor
                Found in app/presenters/v2/user_presenter.rb - About 45 mins to fix

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

                          def entity_hash(controller, service_binding, opts, depth, parents, orphans=nil)
                  Severity: Minor
                  Found in app/presenters/v2/service_binding_presenter.rb - About 45 mins to fix

                    Method value_error has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def value_error
                          return MetadataError.none if value.nil? || value == ''
                    
                          return MetadataError.error("'#{value}' contains invalid characters") unless valid_characters?(value)
                          return MetadataError.error("'#{value}' starts or ends with invalid characters") unless start_end_alphanumeric?(value)
                    Severity: Minor
                    Found in app/messages/metadata_validator_helper.rb - About 45 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 entity_hash has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            def entity_hash(controller, service, opts, depth, parents, orphans=nil)
                    Severity: Minor
                    Found in app/presenters/v2/service_presenter.rb - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language