fog/fog-ecloud

View on GitHub
lib/fog/compute/ecloud/requests/internet_service_create.rb

Summary

Maintainability
A
2 hrs
Test Coverage

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

        def generate_internet_service_request(service_data)
          xml = Builder::XmlMarkup.new
          xml.CreateInternetService(:name => service_data[:name]) do
            xml.Protocol service_data[:protocol]
            xml.Port service_data[:port]
Severity: Minor
Found in lib/fog/compute/ecloud/requests/internet_service_create.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 internet_service_create has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def internet_service_create(service_data)
          validate_internet_service_data(service_data)
          public_ip_id = service_data[:uri].match(/(\d+)/)[1]
          public_ip    = self.data[:public_ips][public_ip_id.to_i].dup
          service_id   = Fog::Mock.random_numbers(6).to_i
Severity: Minor
Found in lib/fog/compute/ecloud/requests/internet_service_create.rb - About 1 hr to fix

    There are no issues that match your filters.

    Category
    Status