Showing 21 of 31 total issues
Method finalize!
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def finalize!
# Try to get username and api key from environment variables.
# They will default to nil if the environment variables are not present.
@api_key = ENV["SL_API_KEY"] if @api_key == UNSET_VALUE
@username = ENV["SL_USERNAME"] if @username == 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 action_up
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def self.action_up
Vagrant::Action::Builder.new.tap do |b|
if defined?(HandleBox)
b.use HandleBox
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 call
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
@app.call(env)
ssh_info = env[:machine].ssh_info
- 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_rebuild
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def self.action_rebuild
Vagrant::Action::Builder.new.tap do |b|
b.use Call, Confirm, I18n.t("vagrant_softlayer.vm.rebuild_confirmation"), :force_rebuild do |env, b2|
if env[:result]
b2.use ConfigValidate
- 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 validate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def validate(machine)
errors = []
errors << I18n.t("vagrant_softlayer.config.api_key_required") if !@api_key
errors << I18n.t("vagrant_softlayer.config.username_required") if !@username
- 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 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(env)
@app.call(env)
ssh_info = env[:machine].ssh_info
Method sl_warden
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def sl_warden(rescue_proc = nil, retry_interval = 0, &block)
begin
yield
rescue ::OpenSSL::SSL::SSLError
raise Errors::SLCertificateError
- 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 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.action_up
Vagrant::Action::Builder.new.tap do |b|
if defined?(HandleBox)
b.use HandleBox
else
Method initialize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize
@api_key = UNSET_VALUE
@api_timeout = UNSET_VALUE
@endpoint_url = UNSET_VALUE
@username = UNSET_VALUE
Method get_vlan_id
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_vlan_id(vlan_name, vlan_space)
return vlan_name unless vlan_name.kind_of?(String)
routers = @env[:sl_client]["SoftLayer_Account"].object_mask("mask[routers,routers.datacenter,routers.networkVlans,routers.networkVlans.networkSpace,routers.networkVlans.type]").getObject["routers"]
- 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_destroy
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.action_destroy
Vagrant::Action::Builder.new.tap do |b|
b.use Call, DestroyConfirm do |env, b2|
if env[:result]
b2.use ConfigValidate
- 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 finalize!
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def finalize!
# Try to get username and api key from environment variables.
# They will default to nil if the environment variables are not present.
@api_key = ENV["SL_API_KEY"] if @api_key == UNSET_VALUE
@username = ENV["SL_USERNAME"] if @username == UNSET_VALUE
Method call
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
env[:ui].info I18n.t("vagrant_softlayer.vm.wait_for_provision")
env[:sl_machine] = env[:sl_client]["SoftLayer_Virtual_Guest"].object_with_id(env[:machine].id.to_i)
- 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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
env[:ui].info I18n.t("vagrant_softlayer.vm.wait_for_rebuild")
#Rechecks every 10 sec
virtual_server = ::SoftLayer::VirtualServer.server_with_id(env[:machine].id.to_i, :client => env[:sl_client])
- 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_provision
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.action_provision
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, Is, :running do |env, b2|
if !env[:result]
- 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_dns
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_dns
unless @env[:machine].provider_config.manage_dns
@logger.debug("Not managing DNS. Going ahead.")
return
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 order_template
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def order_template
template = {
"dedicatedAccountHostOnlyFlag" => @env[:machine].provider_config.dedicated,
"domain" => @env[:machine].provider_config.domain,
"hostname" => get_hostname,
- 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 ssh_keys
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ssh_keys(env, ids_only = false)
account = env[:sl_client]["SoftLayer_Account"]
acc_keys = sl_warden { account.object_mask("mask[id,label]").getSshKeys }
key_ids = []
Array(env[:machine].provider_config.ssh_key).each do |key|
- 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 rebalance!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def rebalance!
read_load_balancers
@load_balancers.each do |load_balancer|
next if load_balancer["virtualServers"].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 read_state
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def read_state(env)
return :not_created unless env[:sl_machine]
wipe_id = lambda do
@logger.info("Machine not found, assuming it got destroyed.")
- 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"