lib/fog/vcloud_director/generators/compute/org_vdc_network.rb

Summary

Maintainability
F
3 days
Test Coverage

Method generate_xml has a Cognitive Complexity of 140 (exceeds 5 allowed). Consider refactoring.
Open

          def generate_xml
            body = Nokogiri::XML::Builder.new do
              attrs = {
                :xmlns => 'http://www.vmware.com/vcloud/v1.5',
                :name  => options[:name]
Severity: Minor
Found in lib/fog/vcloud_director/generators/compute/org_vdc_network.rb - About 2 days 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 generate_xml has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def generate_xml
            body = Nokogiri::XML::Builder.new do
              attrs = {
                :xmlns => 'http://www.vmware.com/vcloud/v1.5',
                :name  => options[:name]
Severity: Major
Found in lib/fog/vcloud_director/generators/compute/org_vdc_network.rb - About 2 hrs to fix

    Avoid deeply nested control flow statements.
    Open

                                      if h.key?(:IpRange)
                                        IpRange {
                                          StartAddress h[:IpRange][:StartAddress]
                                          EndAddress   h[:IpRange][:EndAddress]
                                        }
    Severity: Major
    Found in lib/fog/vcloud_director/generators/compute/org_vdc_network.rb - About 45 mins to fix

      There are no issues that match your filters.

      Category
      Status