Showing 255 of 2,705 total issues
Method genPolicyDocument
has a Cognitive Complexity of 93 (exceeds 75 allowed). Consider refactoring. Open
def self.genPolicyDocument(policies, deploy_obj: nil, bucket_style: false, version: "2012-10-17", doc_id: nil)
if policies
name = nil
doc = {
"Version" => version,
- 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 schema
has 206 lines of code (exceeds 150 allowed). Consider refactoring. Open
def self.schema
{
"type" => "object",
"required" => ["name"],
"description" => "Create Virtual Private Clouds with custom public or private subnets.",
Class Server
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Server < MU::Cloud::Server
# Initialize this cloud resource object. Calling +super+ will invoke the initializer defined under {MU::Cloud}, which should set the attribtues listed in {MU::Cloud::PUBLIC_ATTRS} as well as applicable dependency shortcuts, like <tt>@vpc</tt>, for us.
# @param args [Hash]: Hash of named arguments passed via Ruby's double-splat
def initialize(**args)
Class Role
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Role < MU::Cloud::Role
# Initialize this cloud resource object. Calling +super+ will invoke the initializer defined under {MU::Cloud}, which should set the attribtues listed in {MU::Cloud::PUBLIC_ATTRS} as well as applicable dependency shortcuts, like +@vpc+, for us.
# @param args [Hash]: Hash of named arguments passed via Ruby's double-splat
def initialize(**args)
Class Ansible
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Ansible
# Failure to load or create a deploy
class NoAnsibleExecError < MuError;
end
Method create
has 204 lines of code (exceeds 150 allowed). Consider refactoring. Open
def create
labels = Hash[@tags.keys.map { |k|
[k.downcase, @tags[k].downcase.gsub(/[^-_a-z0-9]/, '-')] }
]
labels["name"] = MU::Cloud::Google.nameStr(@mu_name)
Method createResources
has a Cognitive Complexity of 92 (exceeds 75 allowed). Consider refactoring. Open
def createResources(services, mode="create")
return if services.nil?
parent_thread_id = Thread.current.object_id
services.uniq!
- 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 schema
has 202 lines of code (exceeds 150 allowed). Consider refactoring. Open
def self.schema(config)
toplevel_required = []
gke_defaults = defaults
schema = {
"auto_upgrade" => {
Class MommaCat
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class MommaCat
# An exception denoting a failure in MommaCat#fetchSecret and related methods
class SecretError < MuError;
end
Class CacheCluster
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class CacheCluster < MU::Cloud::CacheCluster
# Initialize this cloud resource object. Calling +super+ will invoke the initializer defined under {MU::Cloud}, which should set the attribtues listed in {MU::Cloud::PUBLIC_ATTRS} as well as applicable dependency shortcuts, like +@vpc+, for us.
# @param args [Hash]: Hash of named arguments passed via Ruby's double-splat
def initialize(**args)
Class MommaCat
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class MommaCat
@myhome = Etc.getpwuid(Process.uid).dir
@nagios_home = "/opt/mu/var/nagios_user_home"
@locks = Hash.new
@deploy_cache = Hash.new
Method groom
has 189 lines of code (exceeds 150 allowed). Consider refactoring. Open
def groom
if @config['notifications'] and @config['notifications']['topic']
# XXX expand to a full reference block for a Notification resource
arn = if @config['notifications']['topic'].match(/^arn:/)
@config['notifications']['topic']
Class Master
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Master
require 'date'
require 'colorize'
require 'fileutils'
autoload :Chef, 'mu/master/chef'
Method toKitten
has a Cognitive Complexity of 88 (exceeds 75 allowed). Consider refactoring. Open
def toKitten(**_args)
bok = {
"cloud" => "AWS",
"credentials" => @credentials,
"cloud_id" => @cloud_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 validateConfig
has a Cognitive Complexity of 88 (exceeds 75 allowed). Consider refactoring. Open
def self.validateConfig(cluster, configurator)
ok = true
cluster['project'] ||= MU::Cloud::Google.defaultProject(cluster['credentials'])
cluster['master_az'] ||= cluster['availability_zone'] if cluster['availability_zone']
- 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 genParams
has 185 lines of code (exceeds 150 allowed). Consider refactoring. Open
def genParams(ext = nil)
params = {
:domain_name => @config['domain_name'] || @deploydata['domain_name']
}
Method toKitten
has 185 lines of code (exceeds 150 allowed). Consider refactoring. Open
def toKitten(**_args)
bok = {
"cloud" => "Google",
"project" => @config['project'],
Method schema
has 185 lines of code (exceeds 150 allowed). Consider refactoring. Open
def self.schema
{
"type" => "object",
"description" => "Create a dedicated database server.",
"required" => ["name", "engine", "size", "cloud"],
Class Role
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Role < MU::Cloud::Role
# Initialize this cloud resource object. Calling +super+ will invoke the initializer defined under {MU::Cloud}, which should set the attribtues listed in {MU::Cloud::PUBLIC_ATTRS} as well as applicable dependency shortcuts, like <tt>@vpc</tt>, for us.
# @param args [Hash]: Hash of named arguments passed via Ruby's double-splat
def initialize(**args)
Method check_dependencies
has a Cognitive Complexity of 87 (exceeds 75 allowed). Consider refactoring. Open
def check_dependencies
ok = true
@config.each_pair { |type, values|
next if !values.instance_of?(Array)
- 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"