Method facter
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def facter
facter_json = cmd_exec("#{facter_exe} -j")
facter_json = JSON.parse(facter_json)
loot = store_loot('puppet.facter', 'text/plain', session, facter_json, 'puppet.facter', 'Puppet facter')
print_good("Stored facter to: #{loot}")
- 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 get_config
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def get_config
# we prefer to run `puppet config print` over getting puppet.conf since it contains env items as well merged in
config = cmd_exec("#{puppet_exe} config print")
loot = store_loot('puppet.conf', 'text/plain', session, config, 'puppet.conf', 'Puppet config file')
print_good("Stored puppet config to: #{loot}")
- 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 get_config
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_config
# we prefer to run `puppet config print` over getting puppet.conf since it contains env items as well merged in
config = cmd_exec("#{puppet_exe} config print")
loot = store_loot('puppet.conf', 'text/plain', session, config, 'puppet.conf', 'Puppet config file')
print_good("Stored puppet config to: #{loot}")
Method initialize
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Puppet Config Gather',
Method puppet_exe
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def puppet_exe
return @puppet if @puppet
['/opt/puppetlabs/puppet/bin/puppet', datastore['PUPPET']].each do |exec|
next unless file?(exec)
- 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 facter_exe
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def facter_exe
return @facter if @facter
['/opt/puppetlabs/puppet/bin/facter', datastore['FACTER']].each do |exec|
next unless file?(exec)
- 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"