Showing 65 of 84 total issues
Method finalize!
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
def finalize!
@password = nil if @password == UNSET_VALUE
@openstack_compute_url = nil if @openstack_compute_url == UNSET_VALUE
@openstack_network_url = nil if @openstack_network_url == UNSET_VALUE
@openstack_orchestration_url = nil if @openstack_orchestration_url == UNSET_VALUE
- 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 resolve_volume_from_hash
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def resolve_volume_from_hash(volume, volume_list, volume_ids)
device = nil
device = volume[:device] if volume.key?(:device)
delete_on_destroy = (volume[:delete_on_destroy].nil?) ? 'true' : volume[:delete_on_destroy]
- 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_server
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def create_server(env, options)
server = {}.tap do |s|
s['name'] = options[:name]
if options[:image_ref].nil?
s['block_device_mapping'] = [{ volume_id: options[:volume_boot][:id],
- 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 action_up
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def self.action_up
new_builder.tap do |b|
b.use HandleBox
b.use ConfigValidate
b.use ConnectOpenstack
- 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 merge
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def merge(other)
result = self.class.new
# Set all of our instance variables on the new class
[self, other].each do |obj|
- 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_server
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def create_server(env, options)
config = env[:machine].provider_config
nova = env[:openstack_client].nova
server_name = config.server_name || env[:machine].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
Class NovaClient
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class NovaClient
include Singleton
include VagrantPlugins::Openstack::HttpUtils
include VagrantPlugins::Openstack::Domain
Class ConfigResolver
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class ConfigResolver
def initialize
@logger = Log4r::Logger.new('vagrant_openstack::action::config_resolver')
end
Method validate_api_version
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def validate_api_version(errors)
if @identity_api_version == '2'
errors << I18n.t('vagrant_openstack.config.tenant_name_required') if @tenant_name.nil? || @tenant_name.empty?
errors << I18n.t('vagrant_openstack.config.invalid_endpoint_type') unless %w(publicURL adminURL internalURL).include?(@endpoint_type)
elsif @identity_api_version == '3'
- 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
File action.rb
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'pathname'
require 'vagrant/action/builder'
module VagrantPlugins
Method resolve_network_from_hash
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def resolve_network_from_hash(network, network_list, network_ids)
if network.key?(:id)
fail Errors::ConflictNetworkNameId, network: network if network.key?(:name)
network_id = network[:id]
fail Errors::UnresolvedNetworkId, id: network_id unless network_ids.include? network_id
- 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
File config_resolver.rb
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
module VagrantPlugins
module Openstack
class ConfigResolver
def initialize
@logger = Log4r::Logger.new('vagrant_openstack::action::config_resolver')
Method finalize!
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def finalize!
@password = nil if @password == UNSET_VALUE
@openstack_compute_url = nil if @openstack_compute_url == UNSET_VALUE
@openstack_network_url = nil if @openstack_network_url == UNSET_VALUE
@openstack_orchestration_url = nil if @openstack_orchestration_url == UNSET_VALUE
Method create_server
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_server(env, options)
config = env[:machine].provider_config
nova = env[:openstack_client].nova
server_name = config.server_name || env[:machine].name
File config.rb
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'vagrant'
require 'colorize'
require 'vagrant-openstack-provider/config/http'
module VagrantPlugins
Method validate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def validate(machine)
errors = _detected_errors
errors << I18n.t('vagrant_openstack.config.password_required') if @password.nil? || @password.empty?
errors << I18n.t('vagrant_openstack.config.username_required') if @username.nil? || @username.empty?
- 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 call
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(env)
@app.call(env)
if env[:machine].provider_config.ssh_disabled
env[:ui].info(I18n.t('vagrant_openstack.ssh_disabled_sync_folders'))
Method initialize
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize
@password = UNSET_VALUE
@openstack_compute_url = UNSET_VALUE
@openstack_network_url = UNSET_VALUE
@openstack_volume_url = UNSET_VALUE
Method resolve_volume_boot
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def resolve_volume_boot(env)
config = env[:machine].provider_config
return nil if config.volume_boot.nil?
return resolve_volume_without_volume_service(env, config.volume_boot, 'vda') unless env[:openstack_client].session.endpoints.key? :volume
- 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 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def authenticate(env)
@logger.info('Authenticating on Keystone')
config = env[:machine].provider_config
@logger.info(I18n.t('vagrant_openstack.client.authentication', project: config.tenant_name, user: config.username))