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
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",
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',
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',
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',
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',
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
Class Gateway
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class Gateway < Fog::Model
identity :name
attribute :id
attribute :location
attribute :resource_group
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: [
Method compare_container_blobs
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
def compare_container_blobs(*)
[
{
'name' => 'test_blob1',
'metadata' => {},
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
- Read upRead up
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 }
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
- Read upRead up
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)
- Read upRead up
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 [
{
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?
- Read upRead up
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_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 = []
- Read upRead up
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