Showing 117 of 386 total issues
Method augment_facts
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def augment_facts(ttls, groups)
fact_groups = Facter::FactGroups.new
@options[:blocked_facts] = fact_groups.blocked_facts unless fact_groups.blocked_facts.nil?
@options[:block_list] = fact_groups.block_list
- 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 expand_command
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def expand_command(command)
exe = nil
args = nil
if (match = command.match(DOUBLE_QUOTED_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 execute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def execute(command, options = {})
on_fail, expand, logger, timeout = extract_options(options)
expanded_command = if !expand && builtin_command?(command) || logger
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 puppet_facts
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def puppet_facts
require 'puppet'
# don't allow puppet logger to be injected in Facter
Options[:allow_external_loggers] = false
- 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 address_to_string
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.address_to_string(sockaddr, mask = nil)
if sockaddr[:sa_family] == FFI::AF_INET
in_addr_ip = FFI::SockaddrIn.new(sockaddr.to_ptr)
if mask && sockaddr[:sa_family] == mask[:sa_family]
- 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 conflicting_configs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.conflicting_configs(options)
no_ruby = !options[:ruby]
no_custom_facts = !options[:custom_facts]
puppet = options[:puppet]
custom_dir = options[:custom_dir].nil? ? false : options[:custom_dir].any?
- 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 make_request
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def make_request(url, headers, timeouts, request_type, proxy)
require 'net/http'
uri = URI.parse(url)
http = http_obj(uri, timeouts, proxy)
- 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_other_facts
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check_other_facts
isa = Facter::Resolvers::Uname.resolve(:processor)
klass = isa == 'sparc' ? 'DmiSparc' : 'Dmi'
product_name = Facter::Resolvers::Solaris.const_get(klass).resolve(:product_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 load_directory_entries
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def load_directory_entries(_collection)
cm = Facter::CacheManager.new
facts = []
entries.each do |file|
basename = File.basename(file)
- 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_release_file
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def read_release_file(fact_name, options)
release_file = options[:release_file]
return unless release_file
output = Facter::Util::FileHelper.safe_read(release_file, nil)
- 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 debug
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def debug(msg)
return unless debugging_active?
if @@message_callback && Options[:allow_external_loggers]
@@message_callback.call(:debug, 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 parse_exception
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_exception(exception, error_message)
if exception.is_a?(Exception)
error_message << exception.message if error_message.empty?
if Options[:trace] && !exception.backtrace.nil?
- 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 confine
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def confine(confines = nil, &block)
case confines
when Hash
confines.each do |fact, values|
@confines.push LegacyFacter::Util::Confine.new(fact, *values)
- 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 popen_rune
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.popen_rune(cmd, opts, child_io, parent_io) # :nodoc:
pid = spawn(*cmd, opts)
child_io.each(&:close)
result = [*parent_io, pid]
if defined? yield
- 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 augment_custom
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def augment_custom(file_global_conf)
return unless file_global_conf
if Options.cli? && !file_global_conf['no-custom-facts'].nil?
@options[:no_custom_facts] = file_global_conf['no-custom-facts']
- 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_version
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def retrieve_version(output)
if output[/(Rawhide)$/]
'Rawhide'
elsif output['release']
output.strip =~ /release (\d[\d.]*)/ ? Regexp.last_match(1) : nil
- 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 augment_external
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def augment_external(global_conf)
return unless global_conf
if Options.cli? && !global_conf['no-external-facts'].nil?
@options[:no_external_facts] = global_conf['no-external-facts']
- 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 release_hash_from_string
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def release_hash_from_string(output, include_patch: false)
return unless output
versions = output.split('.')
{}.tap do |release|
- 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 sort_by_weight
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def sort_by_weight(resolutions)
# sort resolutions:
# - descending by weight
# - multiple facts have the same weight but different types, the :external fact take precedence
# - multiple facts with the same weight and type, the order is preserved.
- 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 mac_from
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def mac_from(ifaddr)
if Socket.const_defined? :PF_LINK
ifaddr.addr&.getnameinfo&.first # sometimes it returns localhost or ip
elsif Socket.const_defined? :PF_PACKET
return if ifaddr.addr.nil?
- 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"