theforeman/foreman_maintain

View on GitHub

Showing 66 of 98 total issues

Method filter_whitelisted has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def filter_whitelisted(steps, options)
      options.validate_options!(:whitelisted)
      if options.key?(:whitelisted)
        steps.select do |step|
          options[:whitelisted] ? step.whitelisted? : !step.whitelisted?
Severity: Minor
Found in lib/foreman_maintain/scenario.rb - About 25 mins 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 complete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def complete(line)
          @complete_line = line.end_with?(' ')
          full_path = line.split(' ')
          complete_path = @complete_line ? full_path : full_path[0..-2]
          dict, path = traverse_tree(@dict, complete_path)
Severity: Minor
Found in lib/foreman_maintain/utils/bash.rb - About 25 mins 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 dnf_action has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def dnf_action(action, packages, with_status: false, assumeyes: false, dnf_options: [], valid_exit_statuses: [0], download_only: false, enabled_repos: [])
      packages = [packages].flatten(1)

      dnf_options << '-y' if assumeyes
      dnf_options << '--downloadonly' if download_only
Severity: Minor
Found in lib/foreman_maintain/package_manager/dnf.rb - About 25 mins 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 validate_target_version! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def validate_target_version!
        return if current_target_version
        unless UpgradeRunner.available_targets.include?(target_version)
          message_start = if target_version
                            "Can't upgrade to #{target_version}"
Severity: Minor
Found in lib/foreman_maintain/cli/upgrade_command.rb - About 25 mins 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 load_step_states has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def load_step_states(steps_hash)
      steps = self.steps.dup
      steps_hash.each do |step_hash|
        until steps.empty?
          step = steps.shift
Severity: Minor
Found in lib/foreman_maintain/scenario.rb - About 25 mins 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 update_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def update_data(enabled, new_ids)
    # init data
    @data[:disabled] = [] unless @data[:disabled]
    @data[:enabled] = [] unless @data[:enabled]

Severity: Minor
Found in definitions/features/sync_plans.rb - About 25 mins 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

Severity
Category
Status
Source
Language