Showing 248 of 460 total issues

Method slurp has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

        def self.slurp(error, service=nil)
          major_error_code = nil
          message = nil
          minor_error_code = nil
          stack_trace = nil
Severity: Minor
Found in lib/fog/vcloud_director/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 post_update_catalog_item_metadata has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

        def post_update_catalog_item_metadata(id, metadata={})
          body = Nokogiri::XML::Builder.new do
            attrs = {
              :xmlns => 'http://www.vmware.com/vcloud/v1.5',
              'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'

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 post_update_media_metadata has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

        def post_update_media_metadata(id, metadata={})
          body = Nokogiri::XML::Builder.new do
            attrs = {
              :xmlns => 'http://www.vmware.com/vcloud/v1.5',
              'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'

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 start has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def start
        if is_running?
            message="VNC server already running"
            STDERR.puts message
            @logger.info message
Severity: Minor
Found in lib/fog/opennebula/requests/compute/OpenNebulaVNC.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 slurp has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def self.slurp(error, service=nil)
          major_error_code = nil
          message = nil
          minor_error_code = nil
          stack_trace = nil
Severity: Minor
Found in lib/fog/vcloud_director/core.rb - About 1 hr to fix

    Method parse_end_element has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              def parse_end_element(name, vm)
                case name
                when 'IpAddress'
                  vm[:ip_address] = value
                when 'Description'
    Severity: Minor
    Found in lib/fog/vcloud_director/parsers/compute/vm_parser_helper.rb - About 1 hr to fix

      Method [] has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def [](service)
            @@connections ||= Hash.new do |hash, key|
              hash[key] = case key
              when :compute
                Fog::Logger.warning("OpenStack[:compute] is not recommended, use Compute[:openstack] for portability")
      Severity: Minor
      Found in lib/fog/bin/openstack.rb - About 1 hr to fix

        Method class_for has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def class_for(key)
              case key
              when :auto_scale
                Fog::Rackspace::AutoScale
              when :block_storage
        Severity: Minor
        Found in lib/fog/bin/rackspace.rb - About 1 hr to fix

          Method get_current_session has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def get_current_session
                    body =
                      {:href => make_href('session/'),
                       :type => 'application/vnd.vmware.vcloud.session+xml',
                       :org => data[:org][:name],
          Severity: Minor
          Found in lib/fog/vcloud_director/requests/compute/get_current_session.rb - About 1 hr to fix

            Method populate_images has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def self.populate_images
                      images = {}
                      images["20010001"] = {
                        "name"=>"SUSE Linux Enterprise Server 11 SP1 for x86",
                        "manifest"=>"https://www-147.ibm.com/cloud/enterprise/ram.ws/RAMSecure/artifact/{6CD09CE4-E99B-D72F-6C29-233C9B2A1676}/1.0/parameters.xml",
            Severity: Minor
            Found in lib/fog/ibm/compute.rb - About 1 hr to fix

              Method post_update_disk_metadata has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def post_update_disk_metadata(id, metadata={})
                        body = Nokogiri::XML::Builder.new do
                          attrs = {
                            :xmlns => 'http://www.vmware.com/vcloud/v1.5',
                            'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'

                Method post_update_vapp_template_metadata has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        def post_update_vapp_template_metadata(id, metadata={})
                          body = Nokogiri::XML::Builder.new do
                            attrs = {
                              :xmlns => 'http://www.vmware.com/vcloud/v1.5',
                              'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'

                  Method post_update_vapp_metadata has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def post_update_vapp_metadata(id, metadata={})
                            body = Nokogiri::XML::Builder.new do
                              attrs = {
                                :xmlns => 'http://www.vmware.com/vcloud/v1.5',
                                'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'

                    Method post_update_catalog_item_metadata has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            def post_update_catalog_item_metadata(id, metadata={})
                              body = Nokogiri::XML::Builder.new do
                                attrs = {
                                  :xmlns => 'http://www.vmware.com/vcloud/v1.5',
                                  'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'

                      Method post_update_media_metadata has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              def post_update_media_metadata(id, metadata={})
                                body = Nokogiri::XML::Builder.new do
                                  attrs = {
                                    :xmlns => 'http://www.vmware.com/vcloud/v1.5',
                                    'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'

                        Method modify_hard_disk_size has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                                  def modify_hard_disk_size(disk_number, new_size)
                                    found = false
                                    @items.each do |item|
                                      if item[:resource_type] == 17
                                        if item[:name] == "Hard disk #{disk_number}"
                        Severity: Minor
                        Found in lib/fog/vcloud_director/generators/compute/disks.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 do_request has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                                def do_request(params)
                                  headers = {
                                    'Accept' => "application/*+xml;version=#{@api_version}",
                                    'x-vcloud-authorization' => vcloud_token
                                  }
                        Severity: Minor
                        Found in lib/fog/vcloud_director/compute.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 validate_instantiate_vapp_template_options has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                                def validate_instantiate_vapp_template_options options
                                  # :network_uri removed, if not specified will use template network config.
                                  valid_opts = [:catalog_item_uri, :name, :vdc_uri]
                                  unless valid_opts.all? { |opt| options.key?(opt) }
                                    raise ArgumentError.new("Required data missing: #{(valid_opts - options.keys).map(&:inspect).join(", ")}")
                        Severity: Minor
                        Found in lib/fog/vcloud/requests/compute/instantiate_vapp_template.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 container_action has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                                def container_action(options = {})
                                  raise ArgumentError, "instance id is a required parameter" unless options.key? :id
                                  raise ArgumentError, "action is a required parameter" unless options.key? :action
                                  result = Docker::Container.get(options[:id], {}, @connection).send(options[:action], options[:options] || {})
                        
                        
                        Severity: Minor
                        Found in lib/fog/fogdocker/requests/compute/container_action.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 mock_update has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                                def mock_update(data, obj_or_collection, status, key, &clean_before_update)
                                  data = Fog::JSON.decode(Fog::JSON.encode(data))
                                  if key
                                    unless self.data[obj_or_collection][key]
                                      raise Fog::CloudSigma::Errors::NotFound.new("Object with uuid #{key} does not exist", 'notexist')
                        Severity: Minor
                        Found in lib/fog/cloudsigma/connection.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

                        Severity
                        Category
                        Status
                        Source
                        Language