Showing 105 of 105 total issues
Class Backup
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class Backup
include Concerns::SystemHelpers
attr_accessor :standard_files, :katello_online_files, :katello_offline_files,
:foreman_online_files, :foreman_offline_files, :fpc_offline_files,
Class ForemanProxy
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class Features::ForemanProxy < ForemanMaintain::Feature
metadata do
label :foreman_proxy
confine do
find_package('foreman-proxy')
Class Executable
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class Executable
extend Forwardable
extend Concerns::Finders
attr_reader :options
Class Dnf
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Dnf < Base
PROTECTOR_CONFIG_FILE = '/etc/dnf/plugins/foreman-protector.conf'.freeze
PROTECTOR_WHITELIST_FILE = '/etc/dnf/plugins/foreman-protector.whitelist'.freeze
def self.parse_envra(envra)
File cli_reporter.rb
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'highline'
module ForemanMaintain
class Reporter
class CLIReporter < Reporter
Class Instance
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Features::Instance < ForemanMaintain::Feature
metadata do
label :instance
end
Class CLIReporter
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class CLIReporter < Reporter
include Concerns::Logger
# Simple spinner able to keep updating current line
class Spinner
def initialize(reporter, interval = 0.1)
Class Scenario
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Scenario
include Concerns::Logger
include Concerns::SystemHelpers
include Concerns::ScenarioMetadata
include Concerns::Finders
Class Base
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Base < Clamp::Command
include Concerns::Finders
attr_reader :runner
Class UpgradeRunner
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class UpgradeRunner < Runner
include Concerns::Finders
# Phases of the upgrade, see README.md for more info
PHASES = [:pre_upgrade_checks,
Class Hammer
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Features::Hammer < ForemanMaintain::Feature
attr_reader :configuration, :config_files
metadata do
label :hammer
Method scenario_failure_message
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scenario_failure_message(scenario)
return if scenario.passed? && !scenario.warning?
message = []
message << <<~MESSAGE
Method ensure_dir_unchanged
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def ensure_dir_unchanged
matching = false
backup_file = File.join(@backup_dir, '.pulp.snar')
alternate_backup = File.join(@backup_dir, '.pulp.snar.backup')
until matching
- 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 scenario_failure_message
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def scenario_failure_message(scenario)
return if scenario.passed? && !scenario.warning?
message = []
message << <<~MESSAGE
- 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 facts
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def facts
unless defined?(@facts)
@facts = {}
regex = /^(["'])(.*)(\1)$/
File.open(os_release_file) do |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
Similar blocks of code found in 3 locations. Consider refactoring. Open
class PulpcoreDump < ForemanMaintain::Procedure
metadata do
description 'Restore pulpcore postgresql dump from backup'
param :backup_dir,
'Path to backup directory',
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 66.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
class CandlepinDump < ForemanMaintain::Procedure
metadata do
description 'Restore candlepin postgresql dump from backup'
param :backup_dir,
'Path to backup directory',
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 66.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
class ForemanDump < ForemanMaintain::Procedure
metadata do
description 'Restore foreman postgresql dump from backup'
param :backup_dir,
'Path to backup directory',
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 66.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method tar_command
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def tar_command(options)
volume_size = options.fetch(:volume_size, nil)
absolute_names = options.fetch(:absolute_names, nil)
validate_volume_size(volume_size) unless volume_size.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 ask_to_select
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def ask_to_select(message, steps, run_strategy)
if assumeyes?
step = steps[@select_option_counter]
@select_option_counter += 1
puts("(assuming option #{@select_option_counter})")
- 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"