Showing 117 of 386 total issues
Method search
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def search(json_data, searched_element, path)
# we hit a dead end, the os was not found on this branch
# and we cannot go deeper
return unless json_data
- 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 call_the_resolver
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def call_the_resolver
virtual = Facter::Resolvers::Windows::Virtualization.resolve(:virtual)
provider = case virtual
when 'hyperv'
metadata = Facter::Resolvers::Az.resolve(:metadata)
- 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 deep_merge
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def deep_merge(left, right, path = [])
ret = nil
if left.is_a?(Hash) && right.is_a?(Hash)
ret = left.merge(right) do |key, left_val, right_val|
- 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_facts_ttls
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def load_facts_ttls
@facts_ttls ||= {}
return if @groups_ttls == []
@groups_ttls.reduce(:merge).each do |group, ttls|
- 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_env
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def load_env(fact = nil)
# Load from the environment, if possible
@environment_vars.each do |name, value|
# Skip anything that doesn't match our regex.
next unless name =~ /^facter_?(\w+)$/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 true?
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def true?
if @block && !@fact
begin
return !!@block.call
rescue StandardError => e
- 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_mounts
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read_mounts(fact_name)
@mounts = []
@auto_home_paths = []
begin
Facter::Util::Resolvers::FilesystemHelper.read_mountpoints&.each do |fs|
Method mac_from_bonded_interface
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def mac_from_bonded_interface(interface_name)
master = bond_master_of(interface_name)
return unless master
output = Facter::Util::FileHelper.safe_read("/proc/net/bonding/#{master}", 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_cli
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def augment_cli(file_cli_conf)
return unless file_cli_conf
@options[:debug] = file_cli_conf['debug'] unless file_cli_conf['debug'].nil?
@options[:trace] = file_cli_conf['trace'] unless file_cli_conf['trace'].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 partitions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def partitions
parts = Facter::Resolvers::Partitions.resolve(:partitions)
# We should exit early if we are running on a node with no partitions
# (e.g. a diskless, netbooted VM)
return nil unless parts
- 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_facts
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def read_facts(fact_name)
files = %w[bios_date bios_vendor bios_version board_asset_tag board_vendor board_name
board_serial chassis_asset_tag chassis_type sys_vendor product_name
product_serial product_uuid product_version]
return unless File.directory?('/sys/class/dmi')
- 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_fact
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def read_fact(searched_fact, fact_group)
data = nil
Facter::Framework::Benchmarking::Timer.measure(searched_fact.name, 'cached') do
data = read_group_json(fact_group)
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 prepended
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.prepended(receiver)
exclude, print_caller = parse_options(ENV['API_DEBUG'])
receiver_methods = receiver.instance_methods - Object.methods
receiver_methods.each do |meth|
- 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_for_metadata
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def query_for_metadata(url, container)
metadata = get_data_from(url)
metadata.each_line do |line|
next if line.empty?
- 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_release_facts
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def build_release_facts(fact_name)
result = Facter::Util::FileHelper.safe_read('/etc/release', nil)
return @fact_list[fact_name] = nil if result.nil?
OS_VERSION_REGEX_PATTERNS.each do |os_version_regex|
- 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_routes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def parse_routes(output, ipv4_type)
routes = []
output.each_line do |line|
parts = line.split(' ').compact
next if parts.include?('linkdown')
- 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_instance
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def parse_instance(gce_data)
instance_data = gce_data['instance']
return if instance_data.nil? || instance_data.empty?
# See https://cloud.google.com/compute/docs/metadata for information about these 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 read_mounts
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def read_mounts(fact_name)
@mounts = []
@auto_home_paths = []
begin
Facter::Util::Resolvers::FilesystemHelper.read_mountpoints&.each do |fs|
- 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 which
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def which(bin)
if absolute_path?(bin)
return bin if File.executable?(bin) && FileTest.file?(bin)
else
search_paths.each do |dir|
- 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_searched_facts
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def load_searched_facts(collection, searched_facts, weight)
searched_facts.each do |fact|
parser = LegacyFacter::Util::Parser.parser_for(fact.file)
next if parser.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"