Showing 248 of 459 total issues

Method put_network_connection_system_section_vapp has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def put_network_connection_system_section_vapp(id, options={})
          options = options.dup

          # Mutate options to new format.
          deprecated = {

    Method instantiate_vapp_template has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def instantiate_vapp_template(vapp_name, template_id, options={})
              unless data[:catalog_items].values.find {|i| i[:template_id] == template_id}
                raise Fog::Compute::VcloudDirector::Forbidden.new(
                  'No such template.'
                )
    Severity: Major
    Found in lib/fog/vcloud_director/requests/compute/instantiate_vapp_template.rb - About 2 hrs to fix

      Method put_network has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def put_network(id, name, options={})
                original_network = data[:networks][id]
                unless original_network
                  raise Fog::Compute::VcloudDirector::Forbidden.new(
                    "No access to entity \"(com.vmware.vcloud.entity.orgVdcNetwork:#{id})\"."
      Severity: Major
      Found in lib/fog/vcloud_director/requests/compute/put_network.rb - About 2 hrs to fix

        Method post_capture_vapp has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

                def post_capture_vapp(vdc_id, name, source_id, options={})
                  body = Nokogiri::XML::Builder.new do
                    attrs = {
                      :xmlns => 'http://www.vmware.com/vcloud/v1.5',
                      'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1',
        Severity: Minor
        Found in lib/fog/vcloud_director/requests/compute/post_capture_vapp.rb - About 2 hrs 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_organization has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def get_organization(id)
                  unless id == data[:org][:uuid]
                    raise Fog::Compute::VcloudDirector::Forbidden.new(
                      "No access to entity \"com.vmware.vcloud.entity.org:#{id}\""
                    )
        Severity: Major
        Found in lib/fog/vcloud_director/requests/compute/get_organization.rb - About 2 hrs to fix

          Method template_pool has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def template_pool(filter = { })
          
                    templates = ::OpenNebula::TemplatePool.new(client)
                    if filter[:id].nil?
                      templates.info!(-2,-1,-1)
          Severity: Major
          Found in lib/fog/opennebula/requests/compute/template_pool.rb - About 2 hrs to fix

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

                  def self.[](service)
                    @@connections ||= Hash.new do |hash, key|
                      hash[key] = case key
                                  when :auto_scaling
                                    Fog::AWS::AutoScaling.new
            Severity: Major
            Found in lib/fog/aws/service_mapper.rb - About 2 hrs to fix

              Method create_server has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def create_server(image_id, options = {})
                        raise Excon::Errors::BadRequest.new("Invalid image ID") unless image_id > 0
              
                        response = Excon::Response.new
                        response.status = 202
              Severity: Major
              Found in lib/fog/clodo/requests/compute/create_server.rb - About 2 hrs to fix

                Method save has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        def save
                          unless persisted?
                            #Lame ...
                            raise RuntimeError, "Should not be here"
                          else
                Severity: Major
                Found in lib/fog/vcloud/models/compute/server.rb - About 2 hrs to fix

                  Method post_upload_disk has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def post_upload_disk(id, name, size, options={})
                            body = Nokogiri::XML::Builder.new do
                              DiskCreateParams(:xmlns => 'http://www.vmware.com/vcloud/v1.5') {
                                attrs = {
                                  :name => name,
                  Severity: Minor
                  Found in lib/fog/vcloud_director/requests/compute/post_upload_disk.rb - About 2 hrs 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 build_source_items has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                            def build_source_items(xml)
                              vms = @configuration[:source_vms]
                              vms.each do |vm|
                                xml.SourcedItem {
                                  xml.Source(:name =>vm[:name], :href => vm[:href])
                  Severity: Major
                  Found in lib/fog/vcloud_director/generators/compute/compose_common.rb - About 2 hrs to fix

                    Method post_upload_media has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            def post_upload_media(vdc_id, name, image_type, size, options={})
                              unless ['iso','floppy'].include?(image_type)
                                raise Fog::Compute::VcloudDirector::BadRequest.new(
                                  'The value of parameter imageType is incorrect.'
                                )
                    Severity: Major
                    Found in lib/fog/vcloud_director/requests/compute/post_upload_media.rb - About 2 hrs to fix

                      Method former_mvp? has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def former_mvp?(committer)
                               [
                                 'Aaron Suggs',
                                 'Akira Matsuda',
                                 'ller', #"Achim Ledermüller" UTF-8 fail?
                      Severity: Major
                      Found in lib/tasks/changelog_task.rb - About 2 hrs to fix

                        Method data has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                def self.data
                                  @data ||= Hash.new do |hash, key|
                                    hash[key] = {
                                      "vms" => [
                                        {
                        Severity: Major
                        Found in lib/fog/opennebula/compute.rb - About 2 hrs to fix

                          Method media_body has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  def media_body(id)
                                    media = data[:medias][id]
                          
                                    body = {
                                      :size => media[:size].to_s,
                          Severity: Minor
                          Found in lib/fog/vcloud_director/requests/compute/get_media.rb - About 2 hrs to fix

                            Method post_instantiate_vapp_template has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    def post_instantiate_vapp_template(vdc_id, vapp_template_id, name, options={})
                                      unless data[:vdcs][vdc_id]
                                        raise Fog::Compute::VcloudDirector::Forbidden.new(
                                          "No access to entity \"(com.vmware.vcloud.entity.vdc:#{vdc_id})\"."
                                        )

                              Method generate_xml has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                        def generate_xml
                                          body = Nokogiri::XML::Builder.new do |xml|
                                            attrs = {
                                              :xmlns => 'http://www.vmware.com/vcloud/v1.5',
                                              'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1'

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

                                      def self.class_for(key)
                                        case key
                                        when :auto_scaling
                                          Fog::AWS::AutoScaling
                                        when :beanstalk
                                Severity: Minor
                                Found in lib/fog/aws/service_mapper.rb - About 1 hr to fix

                                  Method disk_body has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          def disk_body(id)
                                            disk = data[:disks][id]
                                            storage_class_id = disk[:vdc_storage_class]
                                  
                                            body = {
                                  Severity: Minor
                                  Found in lib/fog/vcloud_director/requests/compute/get_disk.rb - About 1 hr to fix

                                    Method build_load_balancer_service has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                              def build_load_balancer_service(xml)
                                                lb_config = @configuration[:LoadBalancerService]
                                                return unless lb_config
                                    
                                                xml.LoadBalancerService {

                                    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