fog/fog-azure-rm

View on GitHub
lib/fog/azurerm/models/application_gateway/gateway.rb

Summary

Maintainability
F
4 days
Test Coverage
F
16%

File gateway.rb has 569 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Fog
  module ApplicationGateway
    class AzureRM
      # Gateway model class for Application Gateway Service
      class Gateway < Fog::Model
Severity: Major
Found in lib/fog/azurerm/models/application_gateway/gateway.rb - About 1 day to fix

    Class Gateway has 35 methods (exceeds 20 allowed). Consider refactoring.
    Open

          class Gateway < Fog::Model
            identity :name
            attribute :id
            attribute :location
            attribute :resource_group
    Severity: Minor
    Found in lib/fog/azurerm/models/application_gateway/gateway.rb - About 4 hrs to fix

      Method serialize_sub_resources has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def serialize_sub_resources(gateway_params)
                ip_configurations = []
                gateway_params[:gateway_ip_configurations].each do |ip_configuration|
                  hash = {}
                  ip_configuration.attributes.each { |key, value| hash[key] = value }
      Severity: Major
      Found in lib/fog/azurerm/models/application_gateway/gateway.rb - About 3 hrs to fix

        Method parse has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

                def self.parse(gateway)
                  hash = {}
                  hash['name'] = gateway.name
                  hash['id'] = gateway.id
                  hash['location'] = gateway.location
        Severity: Minor
        Found in lib/fog/azurerm/models/application_gateway/gateway.rb - About 3 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 save has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

                def save
                  requires :name, :location, :resource_group, :sku_name, :sku_tier, :sku_capacity, :gateway_ip_configurations, :frontend_ip_configurations, :frontend_ports, :backend_address_pools, :backend_http_settings_list, :http_listeners, :request_routing_rules
        
                  validate_gateway_ip_configurations(gateway_ip_configurations) unless gateway_ip_configurations.nil?
                  validate_ssl_certificates(ssl_certificates) unless ssl_certificates.nil?
        Severity: Minor
        Found in lib/fog/azurerm/models/application_gateway/gateway.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 parse has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def self.parse(gateway)
                  hash = {}
                  hash['name'] = gateway.name
                  hash['id'] = gateway.id
                  hash['location'] = gateway.location
        Severity: Major
        Found in lib/fog/azurerm/models/application_gateway/gateway.rb - About 2 hrs to fix

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

                  def validate_ssl_certificates(ssl_certificates)
                    if ssl_certificates.is_a?(Array)
                      if ssl_certificates.any?
                        ssl_certificates.each do |ssl_certificate|
                          if ssl_certificate.is_a?(Hash)
          Severity: Minor
          Found in lib/fog/azurerm/models/application_gateway/gateway.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_backend_address_pools has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                  def validate_backend_address_pools(backend_address_pools)
                    if backend_address_pools.is_a?(Array)
                      if backend_address_pools.any?
                        backend_address_pools.each do |backend_address_pool|
                          if backend_address_pool.is_a?(Hash)
          Severity: Minor
          Found in lib/fog/azurerm/models/application_gateway/gateway.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_backend_http_settings_list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                  def validate_backend_http_settings_list(backend_http_settings_list)
                    if backend_http_settings_list.is_a?(Array)
                      if backend_http_settings_list.any?
                        backend_http_settings_list.each do |backend_http_settings|
                          if backend_http_settings.is_a?(Hash)
          Severity: Minor
          Found in lib/fog/azurerm/models/application_gateway/gateway.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_url_path_maps has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                  def validate_url_path_maps(url_path_maps)
                    if url_path_maps.is_a?(Array)
                      if url_path_maps.any?
                        url_path_maps.each do |url_path_map|
                          if url_path_map.is_a?(Hash)
          Severity: Minor
          Found in lib/fog/azurerm/models/application_gateway/gateway.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_frontend_ip_configurations has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                  def validate_frontend_ip_configurations(frontend_ip_configurations)
                    if frontend_ip_configurations.is_a?(Array)
                      if frontend_ip_configurations.any?
                        frontend_ip_configurations.each do |frontend_ip_configuration|
                          if frontend_ip_configuration.is_a?(Hash)
          Severity: Minor
          Found in lib/fog/azurerm/models/application_gateway/gateway.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_frontend_ports has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                  def validate_frontend_ports(frontend_ports)
                    if frontend_ports.is_a?(Array)
                      if frontend_ports.any?
                        frontend_ports.each do |frontend_port|
                          if frontend_port.is_a?(Hash)
          Severity: Minor
          Found in lib/fog/azurerm/models/application_gateway/gateway.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_probes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                  def validate_probes(probes)
                    if probes.is_a?(Array)
                      if probes.any?
                        probes.each do |probe|
                          if probe.is_a?(Hash)
          Severity: Minor
          Found in lib/fog/azurerm/models/application_gateway/gateway.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_request_routing_rules has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                  def validate_request_routing_rules(request_routing_rules)
                    if request_routing_rules.is_a?(Array)
                      if request_routing_rules.any?
                        request_routing_rules.each do |request_routing_rule|
                          if request_routing_rule.is_a?(Hash)
          Severity: Minor
          Found in lib/fog/azurerm/models/application_gateway/gateway.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_gateway_ip_configurations has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                  def validate_gateway_ip_configurations(gateway_ip_configurations)
                    if gateway_ip_configurations.is_a?(Array)
                      if gateway_ip_configurations.any?
                        gateway_ip_configurations.each do |gateway_ip_configuration|
                          if gateway_ip_configuration.is_a?(Hash)
          Severity: Minor
          Found in lib/fog/azurerm/models/application_gateway/gateway.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_http_listeners has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                  def validate_http_listeners(http_listeners)
                    if http_listeners.is_a?(Array)
                      if http_listeners.any?
                        http_listeners.each do |http_listener|
                          if http_listener.is_a?(Hash)
          Severity: Minor
          Found in lib/fog/azurerm/models/application_gateway/gateway.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

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                          if backend_address_pool.is_a?(Hash)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                          if ssl_certificate.is_a?(Hash)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if missing.length == 1

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                          if frontend_ip_configuration.is_a?(Hash)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if missing.length == 1

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if missing.length == 1

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if missing.length == 1

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if backend_address_pools.is_a?(Array)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if ssl_certificates.is_a?(Array)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if frontend_ports.is_a?(Array)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if probes.is_a?(Array)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if http_listeners.is_a?(Array)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                          if http_listener.is_a?(Hash)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                      if gateway_ip_configurations.any?

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                      if ssl_certificates.any?

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if backend_http_settings_list.is_a?(Array)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                      if backend_http_settings_list.any?

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use each instead of each_with_object.
          Open

                        ip_address.instance_variables.each_with_object({}) { |instance_variable| hash[:ipAddress] = ip_address.instance_variable_get(instance_variable) }

          This cop checks for redundant with_object.

          Example:

          # bad
          ary.each_with_object([]) do |v|
            v
          end
          
          # good
          ary.each do |v|
            v
          end
          
          # bad
          ary.each.with_object([]) do |v|
            v
          end
          
          # good
          ary.each do |v|
            v
          end

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if gateway_ip_configurations.is_a?(Array)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                          if gateway_ip_configuration.is_a?(Hash)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if missing.length == 1

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if url_path_maps.is_a?(Array)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if missing.length == 1

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                      if frontend_ip_configurations.any?

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                          if backend_http_settings.is_a?(Hash)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                      if probes.any?

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if frontend_ip_configurations.is_a?(Array)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                      if frontend_ports.any?

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                          if frontend_port.is_a?(Hash)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                          if probe.is_a?(Hash)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if missing.length == 1

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                      if http_listeners.any?

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                      if backend_address_pools.any?

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                          if url_path_map.is_a?(Hash)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if missing.length == 1

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                      if url_path_maps.any?

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Favor a normal unless-statement over a modifier clause in a multiline statement.
          Open

                    gateway.frontend_ports.each do |port|
                      frontend_port = Fog::ApplicationGateway::AzureRM::FrontendPort.new
                      hash['frontend_ports'] << frontend_port.merge_attributes(Fog::ApplicationGateway::AzureRM::FrontendPort.parse(port))
                    end unless gateway.frontend_ports.nil?

          Checks for uses of if/unless modifiers with multiple-lines bodies.

          Example:

          # bad
          {
            result: 'this should not happen'
          } unless cond
          
          # good
          { result: 'ok' } if cond

          Favor a normal unless-statement over a modifier clause in a multiline statement.
          Open

                    gateway.backend_address_pools.each do |address|
                      backend_address_pool = Fog::ApplicationGateway::AzureRM::BackendAddressPool.new
                      hash['backend_address_pools'] << backend_address_pool.merge_attributes(Fog::ApplicationGateway::AzureRM::BackendAddressPool.parse(address))
                    end unless gateway.backend_address_pools.nil?

          Checks for uses of if/unless modifiers with multiple-lines bodies.

          Example:

          # bad
          {
            result: 'this should not happen'
          } unless cond
          
          # good
          { result: 'ok' } if cond

          Use %i or %I for an array of symbols.
          Open

                    required_params = [
                      :name,
                      :frontend_ip_config_id,
                      :frontend_port_id,
                      :protocol

          This cop can check for array literals made up of symbols that are not using the %i() syntax.

          Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

          Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

          Example: EnforcedStyle: percent (default)

          # good
          %i[foo bar baz]
          
          # bad
          [:foo, :bar, :baz]

          Example: EnforcedStyle: brackets

          # good
          [:foo, :bar, :baz]
          
          # bad
          %i[foo bar baz]

          Use %i or %I for an array of symbols.
          Open

                    required_params = [
                      :name,
                      :default_backend_address_pool_id,
                      :default_backend_http_settings_id,
                      :path_rules

          This cop can check for array literals made up of symbols that are not using the %i() syntax.

          Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

          Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

          Example: EnforcedStyle: percent (default)

          # good
          %i[foo bar baz]
          
          # bad
          [:foo, :bar, :baz]

          Example: EnforcedStyle: brackets

          # good
          [:foo, :bar, :baz]
          
          # bad
          %i[foo bar baz]

          Favor a normal unless-statement over a modifier clause in a multiline statement.
          Open

                    gateway.backend_http_settings_collection.each do |http_setting|
                      backend_http_setting = Fog::ApplicationGateway::AzureRM::BackendHttpSetting.new
                      hash['backend_http_settings_list'] << backend_http_setting.merge_attributes(Fog::ApplicationGateway::AzureRM::BackendHttpSetting.parse(http_setting))
                    end unless gateway.backend_http_settings_collection.nil?

          Checks for uses of if/unless modifiers with multiple-lines bodies.

          Example:

          # bad
          {
            result: 'this should not happen'
          } unless cond
          
          # good
          { result: 'ok' } if cond

          Use %i or %I for an array of symbols.
          Open

                    required_params = [
                      :type,
                      :http_listener_id
                    ]

          This cop can check for array literals made up of symbols that are not using the %i() syntax.

          Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

          Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

          Example: EnforcedStyle: percent (default)

          # good
          %i[foo bar baz]
          
          # bad
          [:foo, :bar, :baz]

          Example: EnforcedStyle: brackets

          # good
          [:foo, :bar, :baz]
          
          # bad
          %i[foo bar baz]

          Use %i or %I for an array of symbols.
          Open

                    required_params = [
                      :name,
                      :protocol,
                      :host,
                      :path,

          This cop can check for array literals made up of symbols that are not using the %i() syntax.

          Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

          Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

          Example: EnforcedStyle: percent (default)

          # good
          %i[foo bar baz]
          
          # bad
          [:foo, :bar, :baz]

          Example: EnforcedStyle: brackets

          # good
          [:foo, :bar, :baz]
          
          # bad
          %i[foo bar baz]

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if request_routing_rules.is_a?(Array)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Favor a normal unless-statement over a modifier clause in a multiline statement.
          Open

                    gateway.url_path_maps.each do |map|
                      url_path_map = Fog::ApplicationGateway::AzureRM::UrlPathMap.new
                      hash['url_path_maps'] << url_path_map.merge_attributes(Fog::ApplicationGateway::AzureRM::UrlPathMap.parse(map))
                    end unless gateway.url_path_maps.nil?

          Checks for uses of if/unless modifiers with multiple-lines bodies.

          Example:

          # bad
          {
            result: 'this should not happen'
          } unless cond
          
          # good
          { result: 'ok' } if cond

          Favor a normal unless-statement over a modifier clause in a multiline statement.
          Open

                    gateway.ssl_certificates.each do |certificate|
                      ssl_certificate = Fog::ApplicationGateway::AzureRM::SslCertificate.new
                      hash['ssl_certificates'] << ssl_certificate.merge_attributes(Fog::ApplicationGateway::AzureRM::SslCertificate.parse(certificate))
                    end unless gateway.ssl_certificates.nil?

          Checks for uses of if/unless modifiers with multiple-lines bodies.

          Example:

          # bad
          {
            result: 'this should not happen'
          } unless cond
          
          # good
          { result: 'ok' } if cond

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                          if request_routing_rule.is_a?(Hash)

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Favor a normal unless-statement over a modifier clause in a multiline statement.
          Open

                    gateway.http_listeners.each do |listener|
                      http_listener = Fog::ApplicationGateway::AzureRM::HttpListener.new
                      hash['http_listeners'] << http_listener.merge_attributes(Fog::ApplicationGateway::AzureRM::HttpListener.parse(listener))
                    end unless gateway.http_listeners.nil?

          Checks for uses of if/unless modifiers with multiple-lines bodies.

          Example:

          # bad
          {
            result: 'this should not happen'
          } unless cond
          
          # good
          { result: 'ok' } if cond

          Favor a normal unless-statement over a modifier clause in a multiline statement.
          Open

                    gateway.request_routing_rules.each do |rule|
                      request_routing_rule = Fog::ApplicationGateway::AzureRM::RequestRoutingRule.new
                      hash['request_routing_rules'] << request_routing_rule.merge_attributes(Fog::ApplicationGateway::AzureRM::RequestRoutingRule.parse(rule))
                    end unless gateway.request_routing_rules.nil?

          Checks for uses of if/unless modifiers with multiple-lines bodies.

          Example:

          # bad
          {
            result: 'this should not happen'
          } unless cond
          
          # good
          { result: 'ok' } if cond

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if missing.length == 1

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use %i or %I for an array of symbols.
          Open

                    required_params = [
                      :name,
                      :ip_addresses
                    ]

          This cop can check for array literals made up of symbols that are not using the %i() syntax.

          Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

          Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

          Example: EnforcedStyle: percent (default)

          # good
          %i[foo bar baz]
          
          # bad
          [:foo, :bar, :baz]

          Example: EnforcedStyle: brackets

          # good
          [:foo, :bar, :baz]
          
          # bad
          %i[foo bar baz]

          Use %i or %I for an array of symbols.
          Open

                    required_params = [
                      :name,
                      :subnet_id
                    ]

          This cop can check for array literals made up of symbols that are not using the %i() syntax.

          Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

          Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

          Example: EnforcedStyle: percent (default)

          # good
          %i[foo bar baz]
          
          # bad
          [:foo, :bar, :baz]

          Example: EnforcedStyle: brackets

          # good
          [:foo, :bar, :baz]
          
          # bad
          %i[foo bar baz]

          Use %i or %I for an array of symbols.
          Open

                    required_params = [
                      :name,
                      :port
                    ]

          This cop can check for array literals made up of symbols that are not using the %i() syntax.

          Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

          Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

          Example: EnforcedStyle: percent (default)

          # good
          %i[foo bar baz]
          
          # bad
          [:foo, :bar, :baz]

          Example: EnforcedStyle: brackets

          # good
          [:foo, :bar, :baz]
          
          # bad
          %i[foo bar baz]

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                      if request_routing_rules.any?

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Favor a normal unless-statement over a modifier clause in a multiline statement.
          Open

                    gateway.frontend_ipconfigurations.each do |frontend_ip_config|
                      frontend_ip_configuration = Fog::ApplicationGateway::AzureRM::FrontendIPConfiguration.new
                      hash['frontend_ip_configurations'] << frontend_ip_configuration.merge_attributes(Fog::ApplicationGateway::AzureRM::FrontendIPConfiguration.parse(frontend_ip_config))
                    end unless gateway.frontend_ipconfigurations.nil?

          Checks for uses of if/unless modifiers with multiple-lines bodies.

          Example:

          # bad
          {
            result: 'this should not happen'
          } unless cond
          
          # good
          { result: 'ok' } if cond

          Favor a normal unless-statement over a modifier clause in a multiline statement.
          Open

                    gateway.gateway_ipconfigurations.each do |ip_configuration|
                      gateway_ip_configuration = Fog::ApplicationGateway::AzureRM::IPConfiguration.new
                      hash['gateway_ip_configurations'] << gateway_ip_configuration.merge_attributes(Fog::ApplicationGateway::AzureRM::IPConfiguration.parse(ip_configuration))
                    end unless gateway.gateway_ipconfigurations.nil?

          Checks for uses of if/unless modifiers with multiple-lines bodies.

          Example:

          # bad
          {
            result: 'this should not happen'
          } unless cond
          
          # good
          { result: 'ok' } if cond

          Use a guard clause instead of wrapping the code inside a conditional expression.
          Open

                    if missing.length == 1

          Use a guard clause instead of wrapping the code inside a conditional expression

          Example:

          # bad
          def test
            if something
              work
            end
          end
          
          # good
          def test
            return unless something
            work
          end
          
          # also good
          def test
            work if something
          end
          
          # bad
          if something
            raise 'exception'
          else
            ok
          end
          
          # good
          raise 'exception' if something
          ok

          Use %i or %I for an array of symbols.
          Open

                    required_params = [
                      :name,
                      :data,
                      :password,
                      :public_cert_data

          This cop can check for array literals made up of symbols that are not using the %i() syntax.

          Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

          Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

          Example: EnforcedStyle: percent (default)

          # good
          %i[foo bar baz]
          
          # bad
          [:foo, :bar, :baz]

          Example: EnforcedStyle: brackets

          # good
          [:foo, :bar, :baz]
          
          # bad
          %i[foo bar baz]

          Use %i or %I for an array of symbols.
          Open

                    required_params = [
                      :name,
                      :port,
                      :protocol,
                      :cookie_based_affinity

          This cop can check for array literals made up of symbols that are not using the %i() syntax.

          Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

          Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

          Example: EnforcedStyle: percent (default)

          # good
          %i[foo bar baz]
          
          # bad
          [:foo, :bar, :baz]

          Example: EnforcedStyle: brackets

          # good
          [:foo, :bar, :baz]
          
          # bad
          %i[foo bar baz]

          Favor a normal unless-statement over a modifier clause in a multiline statement.
          Open

                    gateway.probes.each do |probe|
                      gateway_probe = Fog::ApplicationGateway::AzureRM::Probe.new
                      hash['probes'] << gateway_probe.merge_attributes(Fog::ApplicationGateway::AzureRM::Probe.parse(probe))
                    end unless gateway.probes.nil?

          Checks for uses of if/unless modifiers with multiple-lines bodies.

          Example:

          # bad
          {
            result: 'this should not happen'
          } unless cond
          
          # good
          { result: 'ok' } if cond

          There are no issues that match your filters.

          Category
          Status