Katello/katello

View on GitHub
app/controllers/katello/api/v2/content_view_filter_rules_controller.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method update has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def update
      update_params = rule_params
      update_params[:name] = update_params[:name].first if update_params[:name]

      if @rule.filter.content_type == ContentViewPackageFilter::CONTENT_TYPE

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 process_errata_ids has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def process_errata_ids(select_all_params)
      if select_all_params[:included][:ids].blank?
        select_all_params[:excluded][:ids] ||= [] if select_all_params[:excluded][:ids].nil?
        current_errata_ids = @filter.erratum_rules.map(&:errata_id) + select_all_params[:excluded][:ids]
        query = Erratum
Severity: Minor
Found in app/controllers/katello/api/v2/content_view_filter_rules_controller.rb - About 45 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 rule_params has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def rule_params
      unless @rule_params
        if params[:content_view_filter_rule][:errata_ids].is_a?(Hash)
          ids = process_errata_ids(params[:content_view_filter_rule][:errata_ids])
          params[:content_view_filter_rule][:errata_ids] = ids
Severity: Minor
Found in app/controllers/katello/api/v2/content_view_filter_rules_controller.rb - About 35 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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def create
      rule_clazz = ContentViewFilter.rule_class_for(@filter)

      rules = (rule_params[:name] || []).map do |name|
        rule_clazz.create!(rule_params.except(:name).merge(:filter => @filter, name: name))
Severity: Minor
Found in app/controllers/katello/api/v2/content_view_filter_rules_controller.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

There are no issues that match your filters.

Category
Status