ManageIQ/manageiq

View on GitHub

Showing 284 of 1,313 total issues

Method exp_find_by_token has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring.
Open

  def exp_find_by_token(exp, token, parent_is_not = false)
    if exp.kind_of?(Array)                             # Is this and AND or OR
      result = nil
      exp.find do |e|
        result = exp_find_by_token(e, token) # Look for token
Severity: Minor
Found in lib/miq_expression/subst_mixin.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 exp_replace_qs_tokens has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring.
Open

  def exp_replace_qs_tokens(exp, tokens)
    key = exp.keys.first
    if %w[and or].include?(key)
      exp[key].each { |e| exp_replace_qs_tokens(e, tokens) }
    elsif key == "not"
Severity: Minor
Found in lib/miq_expression/subst_mixin.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 build_document_header has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring.
Open

        def build_document_header
          mri = options.mri
          raise "No settings configured for Table" if mri.table.nil?

          calculate_max_col_widths
Severity: Minor
Found in lib/manageiq/reporting/formatter/text.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 import_customization_template has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring.
Open

      def import_customization_template(custom_template_hash)
        CustomizationTemplate.transaction do
          unless valid_type?(custom_template_hash[:type])
            raise CustomizationTemplateYamlError.new("Customization Template error",
                                                     ["Invalid type: #{custom_template_hash[:type]}"])
Severity: Minor
Found in lib/task_helpers/imports/customization_templates.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