fog/fog-azure-rm

View on GitHub

Showing 528 of 528 total issues

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

        def save
          requires :name, :location, :resource_group

          validate_frontend_ip_configurations(frontend_ip_configurations) unless frontend_ip_configurations.nil?
          validate_load_balancing_rules(load_balancing_rules) unless load_balancing_rules.nil?
Severity: Minor
Found in lib/fog/azurerm/models/network/load_balancer.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_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 parse_storage_object has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def parse_storage_object(object)
  data = {}
  if object.is_a? Hash
    object.each do |k, v|
      if k == 'properties'
Severity: Minor
Found in lib/fog/azurerm/utilities/general.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 parse has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def self.parse(circuit_peering)
          express_route_circuit_peering = {}
          express_route_circuit_peering['id'] = circuit_peering.id
          express_route_circuit_peering['name'] = circuit_peering.name
          express_route_circuit_peering['resource_group'] = get_resource_group_from_id(circuit_peering.id)
Severity: Minor
Found in lib/fog/azurerm/models/network/express_route_circuit_peering.rb - About 1 hr to fix

    Method get_blob_properties has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def get_blob_properties(*)
              blob = Azure::Storage::Blob::Blob.new
              blob.name = 'test_blob'
              blob.metadata = {}
              blob.properties = {
    Severity: Minor
    Found in lib/fog/azurerm/requests/storage/get_blob_properties.rb - About 1 hr to fix

      Method get_express_route_circuit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def get_express_route_circuit(*)
                {
                  'name' => 'circuit_name',
                  'id' => '/subscriptions/########-####-####-####-############/resourceGroup/resource_group_name/providers/Microsoft.Network/expressRouteCircuits/circuit_name',
                  'etag' => 'W/\"00000000-0000-0000-0000-000000000000\"',
      Severity: Minor
      Found in lib/fog/azurerm/requests/network/get_express_route_circuit.rb - About 1 hr to fix

        Method parse_storage_object has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def parse_storage_object(object)
          data = {}
          if object.is_a? Hash
            object.each do |k, v|
              if k == 'properties'
        Severity: Minor
        Found in lib/fog/azurerm/utilities/general.rb - About 1 hr to fix

          Method copy_vhd_to_storage_account has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def copy_vhd_to_storage_account(resource_group, storage_account_name, vhd_path, location, vm_name)
                    # Copy if VHD does not exist belongs to same storage account.
                    vhd_storage_account_name = (vhd_path.split('/')[2]).split('.')[0]
                    if storage_account_name != vhd_storage_account_name
                      if storage_account_name.nil?
          Severity: Minor
          Found in lib/fog/azurerm/requests/compute/create_virtual_machine.rb - About 1 hr to fix

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

                    def get_network_gateway_connection_object(gateway_connection_params)
                      gateway_connection = Azure::ARM::Network::Models::VirtualNetworkGatewayConnection.new
            
                      gateway_connection.name = gateway_connection_params[:name]
                      gateway_connection.location = gateway_connection_params[:location]

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

                      def get_network_gateway_object(virtual_network_params)
                        network_gateway = Azure::ARM::Network::Models::VirtualNetworkGateway.new
              
                        network_gateway.enable_bgp = virtual_network_params[:enable_bgp]
                        network_gateway.gateway_type = virtual_network_params[:gateway_type]

                Method create_or_update_network_interface has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        def create_or_update_network_interface(resource_group_name, name, location, subnet_id, public_ip_address_id, ip_configs_name, private_ip_allocation_method, private_ip_address)

                  Method get_profile_object has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          def get_profile_object(traffic_routing_method, relative_name, ttl, protocol, port, path, endpoints, tags)

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

                            def save(options = {})
                              update_body = options.delete(:update_body)
                              update_body = true if update_body.nil?
                              requires :directory, :key
                              raise ArgumentError.new('body is required when update_body is true') if update_body && attributes[:body].nil?
                    Severity: Minor
                    Found in lib/fog/azurerm/models/storage/file.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_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 list_tagged_resources has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def list_tagged_resources(tag_name, tag_value = nil)
                              msg = "Listing Resources with tagname: #{tag_name}"
                              Fog::Logger.debug msg
                              unless tag_name.nil?
                                query_filter = "tagname eq '#{tag_name}' "
                    Severity: Minor
                    Found in lib/fog/azurerm/requests/resources/list_tagged_resources.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

                    Block has too many lines. [32/25]
                    Open

                    Gem::Specification.new do |spec|
                      spec.name          = 'fog-azure-rm'
                      spec.version       = Fog::AzureRM::VERSION
                      spec.authors       = ['Shaffan Chaudhry', 'Samawia Moin', 'Adnan Khalil', 'Zeeshan Arshad', 'Haider Ali', 'Waqar Haider', 'Bilal Naeem', 'Muhammad Asad', 'Azeem Sajid', 'Maham Nazir', 'Abbas Sheikh']
                      spec.summary       = "Module for the 'fog' gem to support Azure Resource Manager cloud services."
                    Severity: Minor
                    Found in fog-azure-rm.gemspec by rubocop

                    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

                    Method create_or_update_public_ip has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            def create_or_update_public_ip(resource_group, name, location, public_ip_allocation_method, idle_timeout_in_minutes, domain_name_label, tags)
                    Severity: Major
                    Found in lib/fog/azurerm/requests/network/create_or_update_public_ip.rb - About 50 mins to fix

                      Method create_or_update_virtual_network has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              def create_or_update_virtual_network(resource_group_name, virtual_network_name, location, dns_servers, subnets, address_prefixes, tags)
                      Severity: Major
                      Found in lib/fog/azurerm/requests/network/create_or_update_virtual_network.rb - About 50 mins to fix

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

                                def validate_ip_configuration_params(ip_configuration)
                                  required_params = [
                                    :name,
                                    :private_ipallocation_method
                                  ]
                        Severity: Minor
                        Found in lib/fog/azurerm/models/network/virtual_network_gateway.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 attach_network_security_group_to_subnet has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                def attach_network_security_group_to_subnet(resource_group, subnet_name, virtual_network_name, address_prefix, route_table_id, network_security_group_id)
                          Severity
                          Category
                          Status
                          Source
                          Language