Showing 460 of 460 total issues

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

            def initialize
              desc "Update the changelog since the last release"
              task(:github_release) do
      
                File.open('CHANGELOG.md', 'r') do |file|
      Severity: Minor
      Found in lib/tasks/github_release_task.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

      Method do_request has 31 lines of code (exceeds 25 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

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

          class << self
            def class_for(key)
              case key
              when :compute
                Fog::Vcloud::Compute
        Severity: Major
        Found in lib/fog/bin/vcloud.rb and 4 other locations - About 1 hr to fix
        lib/fog/bin/cloudsigma.rb on lines 2..25
        lib/fog/bin/cloudstack.rb on lines 2..25
        lib/fog/bin/fogdocker.rb on lines 2..25
        lib/fog/bin/vcloud_director.rb on lines 2..25

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 54.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

          class << self
            def class_for(key)
              case key
              when :compute
                Fog::Compute::VcloudDirector
        Severity: Major
        Found in lib/fog/bin/vcloud_director.rb and 4 other locations - About 1 hr to fix
        lib/fog/bin/cloudsigma.rb on lines 2..25
        lib/fog/bin/cloudstack.rb on lines 2..25
        lib/fog/bin/fogdocker.rb on lines 2..25
        lib/fog/bin/vcloud.rb on lines 2..25

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 54.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

          class << self
            def class_for(key)
              case key
              when :compute
                Fog::Compute::Fogdocker
        Severity: Major
        Found in lib/fog/bin/fogdocker.rb and 4 other locations - About 1 hr to fix
        lib/fog/bin/cloudsigma.rb on lines 2..25
        lib/fog/bin/cloudstack.rb on lines 2..25
        lib/fog/bin/vcloud.rb on lines 2..25
        lib/fog/bin/vcloud_director.rb on lines 2..25

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 54.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

          class << self
            def class_for(key)
              case key
              when :compute
                Fog::Compute::Cloudstack
        Severity: Major
        Found in lib/fog/bin/cloudstack.rb and 4 other locations - About 1 hr to fix
        lib/fog/bin/cloudsigma.rb on lines 2..25
        lib/fog/bin/fogdocker.rb on lines 2..25
        lib/fog/bin/vcloud.rb on lines 2..25
        lib/fog/bin/vcloud_director.rb on lines 2..25

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 54.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

          class << self
            def class_for(key)
              case key
                when :compute
                  Fog::Compute::CloudSigma
        Severity: Major
        Found in lib/fog/bin/cloudsigma.rb and 4 other locations - About 1 hr to fix
        lib/fog/bin/cloudstack.rb on lines 2..25
        lib/fog/bin/fogdocker.rb on lines 2..25
        lib/fog/bin/vcloud.rb on lines 2..25
        lib/fog/bin/vcloud_director.rb on lines 2..25

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 54.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Method build_firewall_service has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                  def build_firewall_service(xml)
                    firewall_config = @configuration[:FirewallService]
                    return unless firewall_config
        
                    xml.FirewallService {

          Method get_users_from_query has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def get_users_from_query(options={})
                    query = []
                    query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc]
                    query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc]
                    query << "page=#{options[:page]}" if options[:page]
          Severity: Minor
          Found in lib/fog/vcloud_director/requests/compute/get_users_from_query.rb - About 1 hr to fix

            Method get_disks_from_query has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def get_disks_from_query(options={})
                      query = []
                      query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc]
                      query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc]
                      query << "page=#{options[:page]}" if options[:page]
            Severity: Minor
            Found in lib/fog/vcloud_director/requests/compute/get_disks_from_query.rb - About 1 hr to fix

              Method container_get has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def container_get(id)
                        {'id'                         => '2ce79789656e4f7474624be6496dc6d988899af30d556574389a19aade2f9650',
                         'image'                      => 'mattdm/fedora:f19',
                         'command'                    => '/bin/bash',
                         'created'                    => '1389876158',
              Severity: Minor
              Found in lib/fog/fogdocker/requests/compute/container_get.rb - About 1 hr to fix

                Method list_offerings has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        def list_offerings
                          response = Excon::Response.new
                          response.status = 200
                          response.body = {"volumes"=>
                              [{"name"=>"Small",
                Severity: Minor
                Found in lib/fog/ibm/requests/storage/list_offerings.rb - About 1 hr to fix

                  Method get_groups_from_query has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def get_groups_from_query(options={})
                            query = []
                            query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc]
                            query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc]
                            query << "page=#{options[:page]}" if options[:page]
                  Severity: Minor
                  Found in lib/fog/vcloud_director/requests/compute/get_groups_from_query.rb - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language