Katello/katello

View on GitHub
app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method plan has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

          def plan(repository, smart_proxy, options = {})
            force_publication = options.fetch(:force_publication, repository.publication_href.nil?)

            options[:contents_changed] = (options && options.key?(:contents_changed)) ? options[:contents_changed] : true
            publication_content_type = !::Katello::RepositoryTypeManager.find(repository.content_type).pulp3_skip_publication
Severity: Minor
Found in app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb - About 2 hrs 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 7 (exceeds 5 allowed). Consider refactoring.
Open

          def run
            target_repo = ::Katello::Repository.find(input[:target_repository_id])
            if input[:skip_publication]
              #Need to clear smart proxy sync histories for non-publication content_types: docker, ansible collection
              target_repo.clear_smart_proxy_sync_histories if input[:contents_changed]
Severity: Minor
Found in app/lib/actions/pulp3/orchestration/repository/generate_metadata.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

There are no issues that match your filters.

Category
Status