fog/fog-openstack

View on GitHub

Showing 156 of 616 total issues

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

        def set_metadata(collection_name, parent_id, metadata = {})
          if collection_name == "images"
            unless list_images_detail.body['images'].find { |image| image['id'] == parent_id }
              raise Fog::OpenStack::Compute::NotFound
            end
Severity: Minor
Found in lib/fog/openstack/compute/requests/set_metadata.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 credentials has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

          def credentials
            if @token
              identity = {'token' => {'id' => @token}}
            else
              raise CredentialsError, "#{self.class}: User name is required" if @user.name.nil?
Severity: Minor
Found in lib/fog/openstack/auth/token/v2.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 get_endpoint_url has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def get_endpoint_url(names, interfaces, region = nil)
          # TODO: Inject OpenStack Service Types Authority
          names_list = if names.kind_of?(String)
                         [names]
                       else
Severity: Minor
Found in lib/fog/openstack/auth/catalog.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 convert_update_params has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def convert_update_params(params)
          params = params.map do |key, value|
          {
            "path"  => "/#{key}",
            "op"    => value ? "replace" : "remove"
Severity: Minor
Found in lib/fog/openstack/container_infra/models/base.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 create_stack has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def create_stack(arg1, arg2 = nil)
          if arg1.kind_of?(Hash)
            # Normal use: create_stack(options)
            options = arg1
          else
Severity: Minor
Found in lib/fog/openstack/orchestration/requests/create_stack.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 rebuild_server has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def rebuild_server(server_id, _image_ref, _name, _admin_pass = nil, _metadata = nil, _personality = nil)
Severity: Minor
Found in lib/fog/openstack/compute/requests/rebuild_server.rb - About 45 mins to fix

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

            def create_lbaas_healthmonitor(pool_id, type, delay, timeout, max_retries, options = {})
    Severity: Minor
    Found in lib/fog/openstack/network/requests/create_lbaas_healthmonitor.rb - About 45 mins to fix

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

              def list_snapshots(options = true)
                if options.kind_of?(Hash)
                  path = 'os-snapshots'
                  query = options
                else
      Severity: Minor
      Found in lib/fog/openstack/compute/requests/list_snapshots.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 list_volumes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def list_volumes(options = true)
                if options.kind_of?(Hash)
                  path = 'os-volumes'
                  query = options
                else
      Severity: Minor
      Found in lib/fog/openstack/compute/requests/list_volumes.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 create_security_group_rule has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def create_security_group_rule(parent_group_id, ip_protocol, from_port, to_port, cidr, group_id = nil)
      Severity: Minor
      Found in lib/fog/openstack/compute/requests/create_security_group_rule.rb - About 45 mins to fix

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

        def create_tenant_network( tenant_name,
                                   external_net,
                                   router_name = 'router1',
                                   subnet_range = '10.0.0.0/21',
                                   subnet_gateway = '10.0.0.1',
        Severity: Minor
        Found in examples/network/network_subnets_routers.rb - About 45 mins to fix

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

                  def create_security_group_rule(parent_group_id, ip_protocol, from_port, to_port, cidr, group_id = nil)
          Severity: Minor
          Found in lib/fog/openstack/compute/requests/create_security_group_rule.rb - About 45 mins to fix

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

                    def update_metadata(collection_name, parent_id, metadata = {})
                      if collection_name == "images"
                        unless list_images_detail.body['images'].find { |image| image['id'] == parent_id }
                          raise Fog::OpenStack::Compute::NotFound
                        end
            Severity: Minor
            Found in lib/fog/openstack/compute/requests/update_metadata.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 create_temp_url has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    def create_temp_url(container, object, expires, method, options = {})
                      raise ArgumentError, "Insufficient parameters specified." unless container && object && expires && method
                      raise ArgumentError, "Storage must be instantiated with the :openstack_temp_url_key option" if @openstack_temp_url_key.nil?
            
                      scheme = options[:scheme] || @openstack_management_uri.scheme
            Severity: Minor
            Found in lib/fog/openstack/storage/requests/get_object_https_url.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 delete_meta has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    def delete_meta(collection_name, parent_id, _key)
                      if collection_name == "images"
                        unless list_images_detail.body['images'].find { |image| image['id'] == parent_id }
                          raise Fog::OpenStack::Compute::NotFound
                        end
            Severity: Minor
            Found in lib/fog/openstack/compute/requests/delete_meta.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 create_user has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                      def create_user(name, _password, email, tenantId = nil, enabled = true)
            Severity: Minor
            Found in lib/fog/openstack/identity/v2/requests/create_user.rb - About 35 mins to fix

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

                      def create_lb_vip(subnet_id,  pool_id, protocol, protocol_port, options = {})
              Severity: Minor
              Found in lib/fog/openstack/network/requests/create_lb_vip.rb - About 35 mins to fix

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

                        def create_lb_member(pool_id, address, protocol_port, weight, options = {})
                Severity: Minor
                Found in lib/fog/openstack/network/requests/create_lb_member.rb - About 35 mins to fix

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

                          def create_temp_url(container, object, expires, method, options = {})
                  Severity: Minor
                  Found in lib/fog/openstack/storage/requests/get_object_https_url.rb - About 35 mins to fix

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

                            def create_lbaas_l7rule(l7policy_id, type, compare_type, value, options = {})
                    Severity: Minor
                    Found in lib/fog/openstack/network/requests/create_lbaas_l7rule.rb - About 35 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language