Showing 6 of 6 total issues
Method validate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.validate(requested_certname, token, hmac_secret)
@log = Logging.logger[self.class]
@log.debug "attempting to validate token"
@log.info "attempting to validate token for: #{requested_certname.to_s}"
errors = []
- Read upRead up
- Create a ticketCreate a ticket
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 generate_default
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.generate_default(settings_param = {})
os_defaults = (
case RbConfig::CONFIG['host_os']
when /darwin|mac os/
{
- Create a ticketCreate a ticket
Method validate
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.validate(requested_certname, token, hmac_secret)
@log = Logging.logger[self.class]
@log.debug "attempting to validate token"
@log.info "attempting to validate token for: #{requested_certname.to_s}"
errors = []
- Create a ticketCreate a ticket
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(certname, reusable=false, validfor=7200, requester, secret)
- Create a ticketCreate a ticket
Method initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(settings_param = {})
# set up logging
@log = Logging.logger[self.class]
@log.debug "initializing #{self.class.name}"
# validate parameter
- Read upRead up
- Create a ticketCreate a ticket
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 configfile
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def configfile
@log.debug 'Finding config file'
@config_file_paths.each do |file|
@log.debug "Checking if file '#{file}' exists"
if File.file?(file)
- Read upRead up
- Create a ticketCreate a ticket
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"