fog/fog-azure-rm

View on GitHub
lib/fog/azurerm/requests/network/create_load_balancer.rb

Summary

Maintainability
C
1 day
Test Coverage
F
11%

Method create_load_balancer has 13 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def create_load_balancer(_name, _location, _resource_group, _frontend_ip_configuration_name, _subnet_id, _private_ip_address, _private_ip_allocation_method, _public_ip_address_id, _backend_address_pool_names, _load_balancing_rules, _probes, _inbound_nat_rules, _inbound_nat_pools)
Severity: Major
Found in lib/fog/azurerm/requests/network/create_load_balancer.rb - About 1 hr to fix

    Method define_load_balancer has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def define_load_balancer(name, location, frontend_ip_configurations, backend_address_pool_names, load_balancing_rules, probes, inbound_nat_rules, inbound_nat_pools, tags)
              load_balancer = Azure::ARM::Network::Models::LoadBalancer.new
              load_balancer.name = name
              load_balancer.location = location
              load_balancer.tags = tags
    Severity: Minor
    Found in lib/fog/azurerm/requests/network/create_load_balancer.rb - About 1 hr to fix

      Method create_load_balancer has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def create_load_balancer(name, location, resource_group, frontend_ip_configurations, backend_address_pool_names, load_balancing_rules, probes, inbound_nat_rules, inbound_nat_pools, tags)
      Severity: Major
      Found in lib/fog/azurerm/requests/network/create_load_balancer.rb - About 1 hr to fix

        Method define_load_balancer has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                def define_load_balancer(name, location, frontend_ip_configurations, backend_address_pool_names, load_balancing_rules, probes, inbound_nat_rules, inbound_nat_pools, tags)
        Severity: Major
        Found in lib/fog/azurerm/requests/network/create_load_balancer.rb - About 1 hr to fix

          Method define_load_balancing_rule has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def define_load_balancing_rule(load_balancing_rules)
                    load_balancing_rule_arr = []
                    load_balancing_rules.each do |lbr|
                      load_balancing_rule = Azure::ARM::Network::Models::LoadBalancingRule.new
          
          Severity: Minor
          Found in lib/fog/azurerm/requests/network/create_load_balancer.rb - About 1 hr to fix

            Method define_load_balancing_rule has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                    def define_load_balancing_rule(load_balancing_rules)
                      load_balancing_rule_arr = []
                      load_balancing_rules.each do |lbr|
                        load_balancing_rule = Azure::ARM::Network::Models::LoadBalancingRule.new
            
            Severity: Minor
            Found in lib/fog/azurerm/requests/network/create_load_balancer.rb - About 55 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 define_lb_frontend_ip_configurations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                    def define_lb_frontend_ip_configurations(frontend_ip_configurations)
                      frontend_ip_configuration_arr = []
                      frontend_ip_configurations.each do |fic|
                        frontend_ip_configuration = Azure::ARM::Network::Models::FrontendIPConfiguration.new
                        frontend_ip_configuration.private_ipaddress = fic[:private_ipaddress]
            Severity: Minor
            Found in lib/fog/azurerm/requests/network/create_load_balancer.rb - About 25 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 define_load_balancer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                    def define_load_balancer(name, location, frontend_ip_configurations, backend_address_pool_names, load_balancing_rules, probes, inbound_nat_rules, inbound_nat_pools, tags)
                      load_balancer = Azure::ARM::Network::Models::LoadBalancer.new
                      load_balancer.name = name
                      load_balancer.location = location
                      load_balancer.tags = tags
            Severity: Minor
            Found in lib/fog/azurerm/requests/network/create_load_balancer.rb - About 25 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

            Put empty method definitions on a single line.
            Open

                    def create_load_balancer(_name, _location, _resource_group, _frontend_ip_configuration_name, _subnet_id, _private_ip_address, _private_ip_allocation_method, _public_ip_address_id, _backend_address_pool_names, _load_balancing_rules, _probes, _inbound_nat_rules, _inbound_nat_pools)
                    end

            This cop checks for the formatting of empty method definitions. By default it enforces empty method definitions to go on a single line (compact style), but it can be configured to enforce the end to go on its own line (expanded style).

            Note: A method definition is not considered empty if it contains comments.

            Example: EnforcedStyle: compact (default)

            # bad
            def foo(bar)
            end
            
            def self.foo(bar)
            end
            
            # good
            def foo(bar); end
            
            def foo(bar)
              # baz
            end
            
            def self.foo(bar); end

            Example: EnforcedStyle: expanded

            # bad
            def foo(bar); end
            
            def self.foo(bar); end
            
            # good
            def foo(bar)
            end
            
            def self.foo(bar)
            end

            Carriage return character detected.
            Open

            module Fog
              module Network

            There are no issues that match your filters.

            Category
            Status