Showing 65 of 200 total issues
Method which
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def which(bin)
if absolute_path?(bin)
return bin if File.executable?(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 retrieve_from_other_directories
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def retrieve_from_other_directories(interface_name)
DIRS.each do |dir|
next unless File.readable?(dir)
lease_files = Dir.entries(dir).select { |file| file =~ /dhclient.*\.lease/ }
- 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_proc_status
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def read_proc_status
proc_status_content = Facter::Util::FileHelper.safe_readlines('/proc/self/status', nil)
return unless proc_status_content
proc_status_content.each do |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 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 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 read_mounts
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def read_mounts # rubocop:disable Metrics/AbcSize
mounts = {}
FilesystemHelper.read_mountpoints.each do |fs|
device = fs.name
filesystem = fs.mount_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 retrieve_vserver
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def retrieve_vserver
proc_status_content = Facter::Util::FileHelper.safe_readlines('/proc/self/status', nil)
return unless proc_status_content
proc_status_content.each do |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 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 load_for_os
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def load_for_os(operating_system)
# select only classes
classes = ClassDiscoverer.instance.discover_classes(operating_system)
classes.each do |class_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 resolve_fact
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def resolve_fact(searched_fact)
group_name = if searched_fact.file
searched_fact.name
else
@fact_groups.get_fact_group(searched_fact.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 true?
has a Cognitive Complexity of 10 (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 execute
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def execute(command, options = {})
on_fail = options.fetch(:on_fail, :raise)
expand = options.fetch(:expand, true)
logger = options[:logger]
- 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 build_release_facts
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def build_release_facts(fact_name)
result = 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 prepended
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.prepended(receiver) # rubocop:disable Metrics/AbcSize
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 augment_custom
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def augment_custom(file_global_conf)
return unless file_global_conf
if Options.cli?
@options[:custom_facts] = !file_global_conf['no-custom-facts'] unless file_global_conf['no-custom-facts'].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 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 read_facts
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def read_facts(fact_name)
build_disks_hash
FILE_PATHS.each do |key, file|
@fact_list[:disks].each do |disk, 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"
Further reading
Method retrieve_info
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def retrieve_info(fact_name)
ssh_list = []
@file_paths.each do |file_path|
next unless File.directory?(file_path)
- 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"