Showing 156 of 616 total issues
Method floating_ip_addresses
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def floating_ip_addresses
all_floating = if addresses
flattened_values = addresses.values.flatten
flattened_values.select { |d| d["OS-EXT-IPS:type"] == "floating" }.collect { |a| a["addr"] }
else
- 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 authenticate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def authenticate
if !@openstack_management_url || @openstack_must_reauthenticate
@openstack_auth_token = nil if @openstack_must_reauthenticate
token = Fog::OpenStack::Auth::Token.build(openstack_options, @connection_options)
- 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 create_ipsec_site_connection
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_ipsec_site_connection(vpn_service_id, ike_policy_id, ipsec_policy_id, options = {})
response = Excon::Response.new
response.status = 201
data = {
'id' => Fog::Mock.random_numbers(6).to_s,
Method create_temp_url
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_temp_url(container, object, expires, method, options = {})
raise ArgumentError, "Insufficient parameters specified." unless container && object && expires && method
raise ArgumentError, "Storage must be instantiated with the :openstack_temp_url_key option" if @openstack_temp_url_key.nil?
scheme = options[:scheme] || @openstack_management_uri.scheme
Method get_subnet
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_subnet(subnet_id)
response = Excon::Response.new
if data = self.data[:subnets][subnet_id]
response.status = 200
response.body = {
Method list_security_groups
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list_security_groups(options = {})
server_id = if options.kind_of?(Hash)
options.delete(:server_id)
else
options
Method authenticate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def authenticate
if !@openstack_management_url || @openstack_must_reauthenticate
@openstack_auth_token = nil if @openstack_must_reauthenticate
token = Fog::OpenStack::Auth::Token.build(openstack_options, @connection_options)
Method credentials
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def credentials
identity = if @token
{
'methods' => ['token'],
'token' => {'id' => @token}
Method initialize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(options = {})
@openstack_username = options[:openstack_username] || 'admin'
@openstack_tenant = options[:openstack_tenant] || 'admin'
@openstack_auth_uri = URI.parse(options[:openstack_auth_url])
@openstack_management_url = @openstack_auth_uri.to_s
- 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_statistics
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_statistics(meter_id, options = {})
data = {
'period' => options['period'],
'q' => []
}
- 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 create_virtual_address_pairing
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_virtual_address_pairing(username, password, auth_url, tenant, device_id, device_ip_address, network_id)
Method create_cron_trigger
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_cron_trigger(name,
workflow_identifier,
workflow_input = nil,
workflow_params = nil,
pattern = "* * * * *",
Method create_cron_trigger
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_cron_trigger(_name,
_workflow_identifier,
_workflow_input = nil,
_workflow_params = nil,
_pattern = nil,
Method list_volumes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def list_volumes(options = true, options_deprecated = {})
if options.kind_of?(Hash)
path = 'volumes'
query = options
else
- 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 rebuild_server
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def rebuild_server(server_id, image_ref, name, admin_pass = nil, metadata = nil, personality = nil)
Method copy
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def copy(target_directory_key, target_file_key, options = {})
requires :directory, :key
options['Content-Type'] ||= content_type if content_type
options['Access-Control-Allow-Origin'] ||= access_control_allow_origin if access_control_allow_origin
options['Origin'] ||= origin if origin
- 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 find_by_id
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_by_id(id, options = {}) # options can include :subtree_as_ids, :subtree_as_list, :parents_as_ids, :parents_as_list
if options.kind_of? Symbol # Deal with a single option being passed on its own
options = {options => nil}
end
- 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_snapshots
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def list_snapshots(options = true, options_deprecated = {})
if options.kind_of?(Hash)
path = 'snapshots'
query = options
else
- 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_endpoint
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_endpoint(entries, interface, region)
list = []
entries.each do |type|
next unless type.key?('endpoints')
type['endpoints'].each do |endpoint|
- 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 update_meta
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_meta(collection_name, parent_id, key, value)
if collection_name == "images"
unless list_images_detail.body['images'].find { |image| image['id'] == parent_id }
raise Fog::OpenStack::Compute::NotFound
end
- 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"