Method find_puppetca
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def find_puppetca
ssl_dir = Pathname.new ssldir
unless (ssl_dir + "ca").directory?
logger.warn "PuppetCA: SSL/CA unavailable on this machine: ssldir not found at #{ssl_dir}"
raise "SSL/CA unavailable on this machine"
- 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 disable
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def disable certname
raise "No such file #{autosign_file}" unless File.exists?(autosign_file)
found = false
entries = open(autosign_file, File::RDONLY).readlines.collect do |l|
- 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
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def list
find_puppetca
command = "#{@sudo} -S #{@puppetca} --list --all"
logger.debug "Executing #{command}"
response = `#{command}`
- 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 puppetca
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def puppetca mode, certname
raise "Invalid mode #{mode}" unless mode =~ /^(clean|sign)$/
find_puppetca
certname.downcase!
command = "#{@sudo} -S #{@puppetca} --#{mode} #{certname}"
- 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 ca_inventory
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def ca_inventory
inventory = Pathname.new(ssldir).join("ca","inventory.txt")
raise "Unable to find CA inventory file at #{inventory}" unless File.exists?(inventory)
hash = {}
# 0x005a 2011-04-16T07:12:46GMT 2016-04-14T07:12:46GMT /CN=uuid
- 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"