Showing 255 of 2,705 total issues
Method run
has a Cognitive Complexity of 125 (exceeds 75 allowed). Consider refactoring. Open
def run(purpose: "Chef run", update_runlist: true, max_retries: 5, output: true, override_runlist: nil, reboot_first_fail: false, timeout: 1800)
self.class.loadChefLib
if update_runlist and !@config['run_list'].nil?
knifeAddToRunList(multiple: @config['run_list'])
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 generateBaskets
has a Cognitive Complexity of 124 (exceeds 75 allowed). Consider refactoring. Open
def generateBaskets(prefix: "")
groupings = {
"" => MU::Cloud.resource_types.values.map { |v| v[:cfg_plural] }
}
- 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 server_pool.rb
has 1250 lines of code (exceeds 1000 allowed). Consider refactoring. Open
module MU
class Cloud
class AWS
# A server pool as configured in {MU::Config::BasketofKittens::server_pools}
class ServerPool < MU::Cloud::ServerPool
Method manageUser
has a Cognitive Complexity of 121 (exceeds 75 allowed). Consider refactoring. Open
def self.manageUser(user, name: nil, password: nil, email: nil, admin: false, mu_acct: true, unlock: false, ou: $MU_CFG["ldap"]["user_ou"], enable: false, disable: false, change_uid: -1)
cur_users = listUsers
first = last = nil
if !name.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
Class Google
has 54 methods (exceeds 20 allowed). Consider refactoring. Open
class Google
@@authtoken = nil
@@default_project = nil
@@myRegion_var = nil
@@my_hosted_cfg = nil
Method create
has a Cognitive Complexity of 118 (exceeds 75 allowed). Consider refactoring. Open
def create
ext_zone = MU::Cloud::DNSZone.find(cloud_id: @config['name']).values.first
@config["create_zone"] =
if ext_zone
false
- 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 crawlChangeReport
has a Cognitive Complexity of 118 (exceeds 75 allowed). Consider refactoring. Open
def crawlChangeReport(tier, parent_key = nil, indent: "")
report = []
if tier.is_a?(Array)
tier.each { |a|
sub_report = crawlChangeReport(a, parent_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
File server.rb
has 1219 lines of code (exceeds 1000 allowed). Consider refactoring. Open
require 'net/ssh'
require 'net/ssh/multi'
require 'net/ssh/proxy/command'
autoload :OpenStruct, "ostruct"
autoload :Timeout, "timeout"
Method create_update
has a Cognitive Complexity of 117 (exceeds 75 allowed). Consider refactoring. Open
def create_update
@config = MU::Config.manxify(@config)
@config['region'] ||= MU::Cloud::Azure.myRegion(@config['credentials'])
tags = {}
if !@config['scrub_mu_isms']
- 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 method_missing
has 306 lines of code (exceeds 150 allowed). Consider refactoring. Open
def method_missing(method_sym, *arguments)
retries = 0
actual_resource = nil
enable_on_fail = true
Method schema
has 299 lines of code (exceeds 150 allowed). Consider refactoring. Open
def self.schema
{
"type" => "object",
"title" => "loadbalancer",
"description" => "Create Load Balancers",
Class Server
has 49 methods (exceeds 20 allowed). Consider refactoring. Open
class Server < MU::Cloud::Server
# A list of block device names to use if we get a storage block that
# doesn't declare one explicitly.
# This probably fails on some AMIs. It's crude.
File google.rb
has 1193 lines of code (exceeds 1000 allowed). Consider refactoring. Open
require 'googleauth'
require "net/http"
require 'net/https'
require 'multi_json'
require 'stringio'
Method validateConfig
has a Cognitive Complexity of 112 (exceeds 75 allowed). Consider refactoring. Open
def self.validateConfig(cluster, configurator)
ok = true
start = Time.now
cluster['size'] = MU::Cloud.resourceClass("AWS", "Server").validateInstanceType(cluster["instance_type"], cluster["region"])
ok = false if cluster['size'].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
Class Azure
has 46 methods (exceeds 20 allowed). Consider refactoring. Open
class Azure
@@is_in_azure = nil
@@metadata = nil
@@acct_to_profile_map = nil #WHAT EVEN IS THIS?
@@myRegion_var = nil
Method insertKitten
has 282 lines of code (exceeds 150 allowed). Consider refactoring. Open
def insertKitten(descriptor, type, delay_validation = false, ignore_duplicates: false, overwrite: false)
append = false
start = Time.now
shortclass, cfg_name, cfg_plural, classname = MU::Cloud.getResourceNames(type)
Class Database
has 45 methods (exceeds 20 allowed). Consider refactoring. Open
class Database < MU::Cloud::Database
# Map legal storage values for each disk type and database engine so
# our validator can check them for us.
STORAGE_RANGES = {
Method validateConfig
has 270 lines of code (exceeds 150 allowed). Consider refactoring. Open
def self.validateConfig(cluster, configurator)
ok = true
start = Time.now
cluster['size'] = MU::Cloud.resourceClass("AWS", "Server").validateInstanceType(cluster["instance_type"], cluster["region"])
ok = false if cluster['size'].nil?
Method schema
has 262 lines of code (exceeds 150 allowed). Consider refactoring. Open
def self.schema(_config)
toplevel_required = []
term_policies = MU::Cloud::AWS.credConfig ? MU::Cloud::AWS.autoscale.describe_termination_policy_types.termination_policy_types : ["AllocationStrategy", "ClosestToNextInstanceHour", "Default", "NewestInstance", "OldestInstance", "OldestLaunchConfiguration", "OldestLaunchTemplate"]
Method create
has a Cognitive Complexity of 106 (exceeds 75 allowed). Consider refactoring. Open
def create
@cfm_name, @cfm_template = MU::Cloud::CloudFormation.cloudFormationBase("dnszone", self, scrub_mu_isms: @config['scrub_mu_isms'])
MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "Name", @config['name'])
MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "HostedZoneConfig", { "Comment" => MU.deploy_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"