fog/fog-openstack

View on GitHub

Showing 156 of 616 total issues

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

        def floating_ip_addresses
          all_floating = if addresses
                           flattened_values = addresses.values.flatten
                           flattened_values.select { |d| d["OS-EXT-IPS:type"] == "floating" }.collect { |a| a["addr"] }
                         else
Severity: Minor
Found in lib/fog/openstack/compute/models/server.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 authenticate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def authenticate
        if !@openstack_management_url || @openstack_must_reauthenticate
          @openstack_auth_token = nil if @openstack_must_reauthenticate

          token = Fog::OpenStack::Auth::Token.build(openstack_options, @connection_options)
Severity: Minor
Found in lib/fog/openstack/core.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 create_ipsec_site_connection has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def create_ipsec_site_connection(vpn_service_id, ike_policy_id, ipsec_policy_id, options = {})
          response = Excon::Response.new
          response.status = 201
          data = {
            'id'                => Fog::Mock.random_numbers(6).to_s,
Severity: Minor
Found in lib/fog/openstack/network/requests/create_ipsec_site_connection.rb - About 1 hr to fix

    Method create_temp_url has 27 lines of code (exceeds 25 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 1 hr to fix

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

              def get_subnet(subnet_id)
                response = Excon::Response.new
                if data = self.data[:subnets][subnet_id]
                  response.status = 200
                  response.body = {
      Severity: Minor
      Found in lib/fog/openstack/network/requests/get_subnet.rb - About 1 hr to fix

        Method list_security_groups has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def list_security_groups(options = {})
                  server_id = if options.kind_of?(Hash)
                                options.delete(:server_id)
                              else
                                options
        Severity: Minor
        Found in lib/fog/openstack/compute/requests/list_security_groups.rb - About 1 hr to fix

          Method authenticate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def authenticate
                  if !@openstack_management_url || @openstack_must_reauthenticate
                    @openstack_auth_token = nil if @openstack_must_reauthenticate
          
                    token = Fog::OpenStack::Auth::Token.build(openstack_options, @connection_options)
          Severity: Minor
          Found in lib/fog/openstack/core.rb - About 1 hr to fix

            Method credentials has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                      def credentials
                        identity = if @token
                                     {
                                       'methods' => ['token'],
                                       'token'   => {'id' => @token}
            Severity: Minor
            Found in lib/fog/openstack/auth/token/v3.rb - About 1 hr to fix

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

                        def initialize(options = {})
                          @openstack_username = options[:openstack_username] || 'admin'
                          @openstack_tenant = options[:openstack_tenant] || 'admin'
                          @openstack_auth_uri = URI.parse(options[:openstack_auth_url])
                          @openstack_management_url = @openstack_auth_uri.to_s
              Severity: Minor
              Found in lib/fog/openstack/identity/v2.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 get_statistics has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                      def get_statistics(meter_id, options = {})
                        data = {
                          'period' => options['period'],
                          'q'      => []
                        }
              Severity: Minor
              Found in lib/fog/openstack/metering/requests/get_statistics.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 create_virtual_address_pairing has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def create_virtual_address_pairing(username, password, auth_url, tenant, device_id, device_ip_address, network_id)
              Severity: Major
              Found in examples/network/network_add_port.rb - About 50 mins to fix

                Method create_cron_trigger has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                          def create_cron_trigger(name,
                                                  workflow_identifier,
                                                  workflow_input = nil,
                                                  workflow_params = nil,
                                                  pattern = "* * * * *",
                Severity: Major
                Found in lib/fog/openstack/workflow/v2/requests/create_cron_trigger.rb - About 50 mins to fix

                  Method create_cron_trigger has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                            def create_cron_trigger(_name,
                                                    _workflow_identifier,
                                                    _workflow_input = nil,
                                                    _workflow_params = nil,
                                                    _pattern = nil,
                  Severity: Major
                  Found in lib/fog/openstack/workflow/v2/requests/create_cron_trigger.rb - About 50 mins to fix

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

                            def list_volumes(options = true, options_deprecated = {})
                              if options.kind_of?(Hash)
                                path  = 'volumes'
                                query = options
                              else
                    Severity: Minor
                    Found in lib/fog/openstack/volume/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 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 copy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def copy(target_directory_key, target_file_key, options = {})
                                requires :directory, :key
                                options['Content-Type'] ||= content_type if content_type
                                options['Access-Control-Allow-Origin'] ||= access_control_allow_origin if access_control_allow_origin
                                options['Origin'] ||= origin if origin
                      Severity: Minor
                      Found in lib/fog/openstack/storage/models/file.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 find_by_id has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                                def find_by_id(id, options = {}) # options can include :subtree_as_ids, :subtree_as_list, :parents_as_ids, :parents_as_list
                                  if options.kind_of? Symbol # Deal with a single option being passed on its own
                                    options = {options => nil}
                                  end
                      
                      
                      Severity: Minor
                      Found in lib/fog/openstack/identity/v3/models/projects.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_snapshots has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

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

                              def get_endpoint(entries, interface, region)
                                list = []
                                entries.each do |type|
                                  next unless type.key?('endpoints')
                                  type['endpoints'].each do |endpoint|
                      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 update_meta has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def update_meta(collection_name, parent_id, key, value)
                                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_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

                      Severity
                      Category
                      Status
                      Source
                      Language