Showing 66 of 98 total issues
Function sack
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def sack(self):
if self.cli is not None and self.cli.command._basecmd not in PROTECT_COMMANDS:
return
if os.environ.get('LEAPP_IPU_IN_PROGRESS') is not None:
return
- 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 status_for_maintenance_mode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def status_for_maintenance_mode(mode_on)
cron_service = system_service(service_name)
if cron_service.running?
[
'cron jobs: running',
- 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 compose
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def compose
if Packages.skip_installer_run?(context.get(:packages))
add_step_with_context(Procedures::Packages::Update,
:force => true, :warn_on_errors => true)
else
- 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 interactive_option
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.interactive_option(opts = %w[assumeyes whitelist force plaintext])
delete_duplicate_assumeyes_if_any
if opts.include?('assumeyes')
option ['-y', '--assumeyes'], :flag,
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def execute
run_scenario_or_rescue do
locked = ForemanMaintain.package_manager.versions_locked?
puts "Packages are#{locked ? '' : ' not'} locked"
exit_code = locked ? 0 : 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
Function _load_whitelist
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _load_whitelist(self):
fileurl = self._get_whitelist_file_url()
package_whitelist = set()
try:
if fileurl:
- 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 apt_action
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def apt_action(action, packages, with_status: false, assumeyes: false, valid_exit_statuses: [0], download_only: false)
apt_options = []
packages = [packages].flatten(1)
apt_options << '-y' if assumeyes
apt_options << '--download-only' if download_only
- 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 option
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.option(switches, type, description, opts = {}, &block)
Method run
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def run
@scenarios.each do |scenario|
run_scenario(scenario)
next unless @quit
- 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 run
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def run
assumeyes_val = @assumeyes.nil? ? assumeyes? : @assumeyes
packages_action(:install, @packages, :assumeyes => assumeyes_val)
rescue ForemanMaintain::Error::ExecutionError => e
if @warn_on_errors
- 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 run
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def run
self.class.current_target_version = @version
PHASES.each do |phase|
return run_rollback if quit?
- 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 rollback_pre_migrations
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def rollback_pre_migrations
raise "Unexpected phase #{phase}, expecting pre_migrations" unless phase == :pre_migrations
rollback_needed = scenario(:pre_migrations).steps.any? { |s| s.executed? && s.success? }
if rollback_needed
- 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 run
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def run
logger.debug("Invoking tar from #{FileUtils.pwd}")
tar_cmd = tar_command
attempt_no = 1
loop do
- 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 dumps_for_hybrid_db_setup
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def dumps_for_hybrid_db_setup(dbs_hash)
present = []
absent = []
dbs_hash.each do |data_file, dbs|
dbs.each do |db|
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def self.deep_merge!(hash, other_hash)
other_hash = symbolize_hash(other_hash)
hash.merge!(other_hash) do |_key, old_val, new_val|
if old_val.is_a?(Hash) && new_val.is_a?(Hash)
- 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_interfaces
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_interfaces
# I wanted to do `Socket.getifaddrs.map(&:name).uniq`,
# but this has to work with Ruby 2.0, and Socket.getifaddrs is 2.1+
errors = {}
system_interfaces = Dir.entries('/sys/class/net') - ['.', '..']
- 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 run
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def run
assumeyes_val = @assumeyes.nil? ? assumeyes? : @assumeyes
packages_action(:remove, @packages, :assumeyes => assumeyes_val)
rescue ForemanMaintain::Error::ExecutionError => e
if @warn_on_errors
- 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 server_ping_retry
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def server_ping_retry
with_spinner('Checking server response') do |spinner|
RETRIES_FOR_SERVICES_RESTART.times do |retry_count|
spinner.update retry_message(retry_count)
response = feature(:instance).ping
- 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 run_steps
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run_steps(scenario, steps)
@steps_to_run = ForemanMaintain::DependencyGraph.sort(steps)
while (scenario.run_strategy == :fail_slow || !@quit) && !@steps_to_run.empty?
execution = run_step(@steps_to_run.shift)
post_step_decisions(scenario, execution) unless execution.success?
- 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 config_files
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def config_files(for_features = ['all'])
configs = default_config_files
backup_features = backup_features(for_features)
configs.push(certs_tar) if certs_tar
- 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"