Showing 65 of 200 total issues
Avoid too many return
statements within this method. Open
return !!@block.call(value)
Avoid too many return
statements within this method. Open
return false if value[/[0-9]+\.[0-9]+\./]
Avoid too many return
statements within this method. Open
return false
Method error
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def error(msg, colorize = false)
@@has_errors = true
if msg.nil? || msg.empty?
empty_message_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 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 normalize_string
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def normalize_string(value)
value = value.encode(Encoding::UTF_8)
unless value.valid_encoding?
raise NormalizationError, "String #{value.inspect} doesn't match the reported encoding #{value.encoding}"
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def read_facts(fact_name)
files = %w[bios_date bios_vendor bios_version board_vendor board_name board_serial
chassis_asset_tag chassis_type sys_vendor product_name product_serial
product_uuid]
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 debug
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def debug(msg)
return unless debugging?
if msg.nil? || msg.empty?
invoker = caller(1..1).first.slice(/.*:\d+/)
- 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 info
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def info(msg)
if msg.nil? || msg.empty?
empty_message_error(msg)
elsif @@message_callback
@@message_callback.call(:info, 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_selinux_config
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def read_selinux_config
file_lines = Util::FileHelper.safe_readlines('/etc/selinux/config')
file_lines.map do |line|
@fact_list[:config_mode] = line.split('=').last.strip if line =~ /^SELINUX=/
- 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 iterate_list
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def iterate_list(adapter_addresses)
net_interface = {}
IpAdapterAddressesLh.read_list(adapter_addresses) do |adapter_address|
if adapter_down?(adapter_address)
adapter_address = IpAdapterAddressesLh.new(adapter_address[:Next])
- 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 found_fact?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def found_fact?(fact_name, query_fact)
fact_with_wildcard = fact_name.include?('.*') && !query_fact.include?('.')
processed_equery_fact = query_fact.gsub('\\', '\\\\\\\\')
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def address_to_string(addr)
return if addr[:lpSockaddr] == FFI::Pointer::NULL
size = FFI::MemoryPointer.new(NetworkingFFI::INET6_ADDRSTRLEN + 1)
buffer = FFI::MemoryPointer.new(:wchar, NetworkingFFI::INET6_ADDRSTRLEN + 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 query_cuat
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def query_cuat(name)
odmquery = Facter::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 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 warn
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def warn(msg)
if msg.nil? || msg.empty?
empty_message_error(msg)
elsif @@message_callback
@@message_callback.call(:warn, 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 sysctl_by_name
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.sysctl_by_name(type, name)
oldp = FFI::Pointer::NULL
oldlenp = FFI::MemoryPointer.new(:size_t)
newp = FFI::Pointer::NULL
- 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_partitions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def read_partitions(fact_name)
@fact_list[:partitions] = {}
return {} unless File.readable?(BLOCK_PATH)
block_devices = Dir.entries(BLOCK_PATH).reject { |dir| 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 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 execute_command
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def execute_command(command, on_fail, logger = nil)
begin
out, stderr, _status_ = Open3.capture3(command.to_s)
log_stderr(stderr, command, logger)
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"