theforeman/foreman_maintain

View on GitHub

Showing 66 of 98 total issues

Class Backup has 36 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,
Severity: Minor
Found in lib/foreman_maintain/utils/backup.rb - About 4 hrs to fix

    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')
    Severity: Minor
    Found in definitions/features/foreman_proxy.rb - About 4 hrs to fix

      Class Executable has 31 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Executable
          extend Forwardable
          extend Concerns::Finders
          attr_reader :options
      
      
      Severity: Minor
      Found in lib/foreman_maintain/executable.rb - About 3 hrs to fix

        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)
        Severity: Minor
        Found in lib/foreman_maintain/package_manager/dnf.rb - About 3 hrs to fix

          File cli_reporter.rb has 317 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'highline'
          
          module ForemanMaintain
            class Reporter
              class CLIReporter < Reporter
          Severity: Minor
          Found in lib/foreman_maintain/reporter/cli_reporter.rb - About 3 hrs to fix

            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)
            Severity: Minor
            Found in lib/foreman_maintain/reporter/cli_reporter.rb - About 3 hrs to fix

              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
              Severity: Minor
              Found in lib/foreman_maintain/scenario.rb - About 2 hrs to fix

                Class Instance has 25 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Features::Instance < ForemanMaintain::Feature
                  metadata do
                    label :instance
                  end
                
                
                Severity: Minor
                Found in definitions/features/instance.rb - About 2 hrs to fix

                  Class Base has 24 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                      class Base < Clamp::Command
                        include Concerns::Finders
                  
                        attr_reader :runner
                  
                  
                  Severity: Minor
                  Found in lib/foreman_maintain/cli/base.rb - About 2 hrs to fix

                    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
                    Severity: Minor
                    Found in definitions/features/hammer.rb - About 2 hrs to fix

                      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,
                      Severity: Minor
                      Found in lib/foreman_maintain/upgrade_runner.rb - About 2 hrs to fix

                        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.strip_heredoc
                        Severity: Major
                        Found in lib/foreman_maintain/reporter/cli_reporter.rb - About 2 hrs to fix

                          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.strip_heredoc
                          Severity: Minor
                          Found in lib/foreman_maintain/reporter/cli_reporter.rb - About 1 hr to fix

                          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 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
                          Severity: Minor
                          Found in definitions/procedures/backup/pulp.rb - About 1 hr to fix

                          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|
                          Severity: Minor
                          Found in lib/foreman_maintain/concerns/os_facts.rb - About 1 hr to fix

                          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 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def run
                                unless @preserve_dir
                                  puts "Creating backup folder #{@backup_dir}"
                          
                                  FileUtils.mkdir_p @backup_dir
                          Severity: Minor
                          Found in definitions/procedures/backup/prepare_directory.rb - About 1 hr to fix

                          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 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?
                          
                          
                          Severity: Minor
                          Found in definitions/features/tar.rb - About 1 hr to fix

                          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})")
                          Severity: Minor
                          Found in lib/foreman_maintain/reporter/cli_reporter.rb - About 1 hr to fix

                          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?
                                  puts('(assuming first option)')
                                  return steps.first
                                end
                          Severity: Minor
                          Found in lib/foreman_maintain/reporter.rb - About 1 hr to fix

                          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 tar_command has 32 lines of code (exceeds 25 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?
                          
                          
                          Severity: Minor
                          Found in definitions/features/tar.rb - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language