fog/fog-terremark

View on GitHub

Showing 38 of 38 total issues

Method get_vdc has 101 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def get_vdc(vdc_id)
          vdc_id = vdc_id.to_i
          response = Excon::Response.new

          vdc = self.data[:organizations].map { |org| org[:vdcs] }.flatten.find { |vdc| vdc[:id] == vdc_id }
Severity: Major
Found in lib/fog/compute/terremark/requests/get_vdc.rb - About 4 hrs to fix

    Method mock_data has 82 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def self.mock_data
              {
                  :organizations =>
                      [
                          {
    Severity: Major
    Found in lib/fog/compute/terremark/mock.rb - About 3 hrs to fix

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

              def instantiate_vapp_template(name, vapp_template, options = {})
                raise ArgumentError.new("Name must be fewer than 15 characters") unless name.length < 15
                raise ArgumentError.new("vApp Image Template is a compulsary parameter") unless vapp_template
                options["ssh_key_fingerprint"] ||= default_ssh_key["FingerPrint"]
                options["cpus"] ||= 1
      Severity: Minor
      Found in lib/fog/compute/terremark/requests/instantiate_vapp_template.rb - About 1 hr to fix

        Method configure_vapp has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def configure_vapp(vapp_id, vapp_name, options = {})
                  items = ""
                  vapp_uri = [@host, @path, "vApp", vapp_id.to_s].join("/")
        
                  if options["vcpus"]
        Severity: Minor
        Found in lib/fog/compute/terremark/requests/configure_vapp.rb - About 1 hr to fix

          Method start_element has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

                  def start_element(name, attributes)
                    super
                    case name
                    when "Link"
                      link = extract_attributes(attributes)
          Severity: Minor
          Found in lib/fog/parsers/terremark/get_organization.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 end_element has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

                  def end_element(name)
                    case name
                    when "Description", "Protocol"
                      @internet_service[name] = value
                    when "Enabled"
          Severity: Minor
          Found in lib/fog/parsers/terremark/get_internet_services.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 get_network has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def get_network(network_id)
                    network_id = network_id.to_i
                    response = Excon::Response.new
                    network = self.data[:organizations].map { |org| org[:vdcs].map { |vdc| vdc[:networks] } }.flatten.find { |network| network[:id] == network_id }
                    if network
          Severity: Minor
          Found in lib/fog/compute/terremark/requests/get_network.rb - About 1 hr to fix

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

                    def instantiate_vapp_template(name, vapp_template, options = {})
                      raise ArgumentError.new("Name must be fewer than 15 characters") unless name.length < 15
                      raise ArgumentError.new("vApp Image Template is a compulsary parameter") unless vapp_template
                      options["ssh_key_fingerprint"] ||= default_ssh_key["FingerPrint"]
                      options["cpus"] ||= 1
            Severity: Minor
            Found in lib/fog/compute/terremark/requests/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 get_public_ips has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def get_public_ips(vdc_id)
                      vdc_id = vdc_id.to_i
                      response = Excon::Response.new
            
                      vdc = self.data[:organizations].map { |org| org[:vdcs] }.flatten.find { |vdc| vdc[:id] == vdc_id }
            Severity: Minor
            Found in lib/fog/compute/terremark/requests/get_public_ips.rb - About 1 hr to fix

              Method end_element has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def end_element(name)
                        case name
                        when "Description", "Protocol"
                          @internet_service[name] = value
                        when "Enabled"
              Severity: Minor
              Found in lib/fog/parsers/terremark/get_internet_services.rb - About 1 hr to fix

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

                        def create_internet_services(internet_spec)
                          public_ip_info = nil
                          internet_service_id = nil
                          internet_spec.each do |proto, ports|
                            for port in ports
                Severity: Minor
                Found in lib/fog/compute/terremark/models/server.rb - About 1 hr to fix

                  Method end_element has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def end_element(name)
                            case name
                            when "IpAddress"
                              @response["IpAddress"] = value
                            when "Description"
                  Severity: Minor
                  Found in lib/fog/parsers/terremark/vapp.rb - About 1 hr to fix

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

                            def end_element(name)
                              case name
                              when "Description", "Protocol"
                                @response[name] = value
                              when "Enabled"
                    Severity: Minor
                    Found in lib/fog/parsers/terremark/internet_service.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 start_element has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            def start_element(name, attributes)
                              super
                              case name
                              when "Cpu"
                                @in_cpu = true
                    Severity: Minor
                    Found in lib/fog/parsers/terremark/get_vdc.rb - About 1 hr to fix

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

                              def end_element(name)
                                case name
                                when "Allocated", "Limit", "Units", "Used"
                                  if @in_cpu
                                    @response["ComputeCapacity"]["Cpu"][name] = value
                      Severity: Minor
                      Found in lib/fog/parsers/terremark/get_vdc.rb - About 1 hr to fix

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

                                def save
                                  requires :Name, :Protocol, :Port
                                  if !public_ip_address_id
                                    #Create the first internet service and allocate public IP
                                    data = service.create_internet_service(
                        Severity: Minor
                        Found in lib/fog/compute/terremark/models/internetservice.rb - About 1 hr to fix

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

                                  def start_element(name, attributes)
                                    super
                                    case name
                                    when "Link"
                                      link = extract_attributes(attributes)
                          Severity: Minor
                          Found in lib/fog/parsers/terremark/get_organization.rb - About 1 hr to fix

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

                                    def end_element(name)
                                      case name
                                      when "Description", "Protocol"
                                        @response[name] = value
                                      when "Enabled"
                            Severity: Minor
                            Found in lib/fog/parsers/terremark/internet_service.rb - About 1 hr to fix

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

                                      def end_element(name)
                                        case name
                                        when "IpAddress"
                                          @response["IpAddress"] = value
                                        when "Description"
                              Severity: Minor
                              Found in lib/fog/parsers/terremark/vapp.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_internet_service has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                      def create_internet_service(vdc_id, name, protocol, port, options = {})
                              Severity: Minor
                              Found in lib/fog/compute/terremark/requests/create_internet_service.rb - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language