Showing 117 of 386 total issues
Method cache_facts
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def cache_facts(resolved_facts)
return unless Options[:cache] && Options[:ttls].any?
@groups = {}
resolved_facts.each do |fact|
- 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 check_virtualbox
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_virtualbox
virtualbox_details = nil
if Facter::Resolvers::Linux::DmiBios.resolve(:product_name) == 'VirtualBox' ||
Facter::Resolvers::VirtWhat.resolve(:vm) =~ /virtualbox/ ||
- 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 extract_vm_and_info
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def extract_vm_and_info(output_docker, output_lxc, lxc_from_environ)
vm = nil
if output_docker
vm = 'docker'
info = output_docker[1]
- 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 if_no_env_vars_set_defaults
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def if_no_env_vars_set_defaults
ENV['FACTER_ROOT'] = __dir__.gsub('/.github/actions', '') unless ENV['FACTER_ROOT']
ENV['SHA'] = 'latest' unless ENV['SHA']
ENV['RELEASE_STREAM'] = 'puppet7' unless ENV['RELEASE_STREAM']
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 read_selinux_config
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def read_selinux_config
file_lines = Facter::Util::FileHelper.safe_readlines('/etc/selinux/config')
file_lines.map do |line|
@fact_list[:config_mode] = line.split('=').last.strip if /^SELINUX=/.match?(line)
- 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 query_cuat
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def query_cuat(name)
odmquery = Facter::Util::Aix::ODMQuery.new
odmquery.equals('name', name)
result = odmquery.execute
- 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 build_bindings
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_bindings(name, ip, mask_length, is_ipv4)
bind_to_add = is_ipv4 ? :bindings : :bindings6
ip = ip.gsub(/%[0-9]$/, '') # remove mask information if it exists
mask_length = mask_length.to_i - 1 unless is_ipv4
@fact_list[:interfaces][name] ||= {}
- 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 retrieve_windows_binaries_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def retrieve_windows_binaries_path
require_relative '../../../facter/resolvers/windows/ffi/system32_ffi'
windows_path = ENV['SystemRoot']
- 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 error
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def error(msg, colorize = false) # rubocop:disable Style/OptionalBooleanParameter
@@has_errors = true
if @@message_callback && Options[:allow_external_loggers]
@@message_callback.call(:error, msg)
- 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 read_ipaddress
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def read_ipaddress(fact_name)
ip = nil
primary_interface = read_primary_interface
unless primary_interface.nil?
output = Facter::Core::Execution.execute("ifconfig #{primary_interface}", logger: log)
- 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 update_changelog
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_changelog
old_lines = File.read(changelog).split("\n")
new_lines = [
"## [#{version}](https://github.com/puppetlabs/facter/tree/#{version}) (#{Time.now.strftime '%Y-%m-%d'})\n",
- 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 execute_svmon
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def execute_svmon(fact_name)
result = Facter::Core::Execution.execute('svmon', logger: log)
return if result.empty?
pagesize = call_pagesize.to_i
- 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 find_command
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_command
num_stacks = 0
XEN_COMMANDS.each do |command|
num_stacks += 1 if File.exist?(command)
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 sysctl
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.sysctl(type, oids)
name = FFI::MemoryPointer.new(:uint, oids.size)
name.write_array_of_uint(oids)
namelen = oids.size
- 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 validate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.validate(options)
DUPLICATED_OPTIONS_RULES.each do |key, value|
if options.include?(key) && options.include?(value)
write_error_and_exit("option #{value} cannot be specified more than once.")
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 create_or_return_resolution
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_or_return_resolution(resolution_name, resolution_type)
resolve = resolution(resolution_name)
if resolve
if resolution_type != resolve.resolution_type
- 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 build_fact_list
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_fact_list(reg)
reg.each do |name, _type, value|
case name
when 'EditionID'
@fact_list[:edition_id] = value
- 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"