fog/fog-azure-rm

View on GitHub

Showing 207 of 528 total issues

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

    Method get_load_balancer has 144 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def get_load_balancer(*)
              response = '{
                "name":"mylb1",
                "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/mylb1",
                "location":"North US",
    Severity: Major
    Found in lib/fog/azurerm/requests/network/get_load_balancer.rb - About 5 hrs to fix

      Method list_network_security_groups has 137 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def list_network_security_groups(resource_group)
                [
                  {
                    'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup",
                    'name' => 'testGroup',
      Severity: Major
      Found in lib/fog/azurerm/requests/network/list_network_security_groups.rb - About 5 hrs to fix

        Method get_network_security_group has 137 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def get_network_security_group(resource_group_name, security_group_name)
                  network_security_group = {
                    'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}",
                    'name' => security_group_name,
                    'type' => 'Microsoft.Network/networkSecurityGroups',
        Severity: Major
        Found in lib/fog/azurerm/requests/network/get_network_security_group.rb - About 5 hrs to fix

          Method get_application_gateway has 133 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def get_application_gateway(*)
                    response = '{
                      "id": "/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/gateway",
                      "name": "gateway",
                      "type": "Microsoft.Network/applicationGateways",

            Method remove_security_rule has 119 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def remove_security_rule(resource_group_name, security_group_name, _security_rule_name)
                      network_security_group = {
                        'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{name}",
                        'name' => security_group_name,
                        'type' => 'Microsoft.Network/networkSecurityGroups',
            Severity: Major
            Found in lib/fog/azurerm/requests/network/remove_security_rule.rb - About 4 hrs to fix

              Method add_security_rules has 119 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def add_security_rules(resource_group_name, security_group_name, security_rules)
                        network_security_group = {
                          'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}",
                          'name' => security_group_name,
                          'type' => 'Microsoft.Network/networkSecurityGroups',
              Severity: Major
              Found in lib/fog/azurerm/requests/network/add_security_rules.rb - About 4 hrs to fix

                Method create_or_update_network_security_group has 119 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        def create_or_update_network_security_group(resource_group_name, security_group_name, location, security_rules)
                          network_security_group = {
                            'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}",
                            'name' => security_group_name,
                            'type' => 'Microsoft.Network/networkSecurityGroups',

                  File create_virtual_machine.rb has 362 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'base64'
                  
                  WHITE_SPACE = ' '.freeze
                  
                  module Fog
                  Severity: Minor
                  Found in lib/fog/azurerm/requests/compute/create_virtual_machine.rb - About 4 hrs 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 list_blobs has 110 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              def list_blobs(*)
                                Fog::Logger.debug 'Listing blobs in container successfully.'
                                {
                                  next_marker: 'marker',
                                  blobs: [
                      Severity: Major
                      Found in lib/fog/azurerm/requests/storage/list_blobs.rb - About 4 hrs to fix

                        Method compare_container_blobs has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                def compare_container_blobs(*)
                                  [
                                    {
                                      'name' => 'test_blob1',
                                      'metadata' => {},
                        Severity: Major
                        Found in lib/fog/azurerm/requests/storage/compare_container_blobs.rb - About 4 hrs to fix

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

                                  def self.parse(nic)
                                    hash = {}
                                    hash['id'] = nic.id
                                    hash['name'] = nic.name
                                    hash['location'] = nic.location
                          Severity: Minor
                          Found in lib/fog/azurerm/models/network/network_interface.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 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 wait_blob_copy_operation_to_finish has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                            Open

                                    def wait_blob_copy_operation_to_finish(container_name, blob_name, copy_id, copy_status, timeout = nil)
                                      begin
                                        start_time = Time.new
                                        while copy_status == COPY_STATUS[:PENDING]
                                          blob = get_blob_properties(container_name, blob_name)

                            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 get_blob has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    def get_blob(_container_name, _blob_name, _options = {}, &_block)
                                      Fog::Logger.debug 'get_blob successfully.'
                                      unless block_given?
                                        return [
                                          {
                            Severity: Major
                            Found in lib/fog/azurerm/requests/storage/get_blob.rb - About 2 hrs to fix

                              Method list_blobs has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                              Open

                                      def list_blobs(container_name, options = {})
                                        options = options.dup
                                        options[:metadata] = true
                                        next_marker = nil
                                        blobs = []
                              Severity: Minor
                              Found in lib/fog/azurerm/requests/storage/list_blobs.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 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

                              Class Server has 24 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                                    class Server < Fog::Model
                                      attribute :id
                                      identity  :name
                                      attribute :location
                                      attribute :resource_group
                              Severity: Minor
                              Found in lib/fog/azurerm/models/compute/server.rb - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language