Katello/katello

View on GitHub
app/lib/actions/katello/content_view_version/incremental_update.rb

Summary

Maintainability
D
2 days
Test Coverage

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

        def plan(old_version, environments, options = {})
          dep_solve = options.fetch(:resolve_dependencies, true)
          description = options.fetch(:description, '')
          content = options.fetch(:content, {})
          new_components = options.fetch(:new_components, [])
Severity: Minor
Found in app/lib/actions/katello/content_view_version/incremental_update.rb - About 6 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 plan has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def plan(old_version, environments, options = {})
          dep_solve = options.fetch(:resolve_dependencies, true)
          description = options.fetch(:description, '')
          content = options.fetch(:content, {})
          new_components = options.fetch(:new_components, [])
Severity: Major
Found in app/lib/actions/katello/content_view_version/incremental_update.rb - About 3 hrs to fix

    File incremental_update.rb has 282 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Actions
      module Katello
        module ContentViewVersion
          class IncrementalUpdate < Actions::EntryAction
            include ::Katello::ContentViewHelper
    Severity: Minor
    Found in app/lib/actions/katello/content_view_version/incremental_update.rb - About 2 hrs to fix

      Method components_repo_instances has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

              def components_repo_instances(old_version_repo, new_component_versions)
                # Attempt to locate the repo instance in the new component versions
                new_repos = nil
                new_component_versions.map do |cvv|
                  cvv.repositories.each do |component_repo|
      Severity: Minor
      Found in app/lib/actions/katello/content_view_version/incremental_update.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 components_repo_instances has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def components_repo_instances(old_version_repo, new_component_versions)
                # Attempt to locate the repo instance in the new component versions
                new_repos = nil
                new_component_versions.map do |cvv|
                  cvv.repositories.each do |component_repo|
      Severity: Minor
      Found in app/lib/actions/katello/content_view_version/incremental_update.rb - About 1 hr to fix

        Method pulp3_repo_mapping has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

                def pulp3_repo_mapping(repo_mapping, old_version)
                  pulp3_repo_mapping = {}
                  repo_mapping.each do |source_repos, dest_repo|
                    old_version_repo = old_version.repositories.archived.find_by(root_id: dest_repo.root_id)
        
        
        Severity: Minor
        Found in app/lib/actions/katello/content_view_version/incremental_update.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 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def run
                  content = { ::Katello::Erratum::CONTENT_TYPE => [],
                              ::Katello::Rpm::CONTENT_TYPE => [],
                              ::Katello::ModuleStream::CONTENT_TYPE => [],
                              ::Katello::Deb::CONTENT_TYPE => []
        Severity: Minor
        Found in app/lib/actions/katello/content_view_version/incremental_update.rb - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                    if input[:is_composite] || input[:copy_action_outputs].present? && input[:copy_action_outputs].last[:pulp_tasks].present?
                      new_repos.each do |new_repo|
                        matched_old_repo = base_repos.where(root_id: new_repo.root_id).first
          
                        new_errata = new_repo.errata - (matched_old_repo&.errata || [])
          Severity: Major
          Found in app/lib/actions/katello/content_view_version/incremental_update.rb - About 40 mins to fix

            Method plan_copy has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    def plan_copy(action_class, source_repo, target_repo, clauses = nil, override_config = nil)
            Severity: Minor
            Found in app/lib/actions/katello/content_view_version/incremental_update.rb - About 35 mins to fix

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

                      def validate_content(old_version, content, components)
                        if old_version.content_view.composite?
                          fail(_("Cannot specify content for composite views")) unless content.empty?
                          validate_components(old_version, components)
                        else
              Severity: Minor
              Found in app/lib/actions/katello/content_view_version/incremental_update.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 finalize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                      def finalize
                        version = ::Katello::ContentViewVersion.find(input[:new_content_view_version_id])
                        version.update_content_counts!
                        version.add_applied_filters!
                        generate_description(version, output[:added_units]) if version.description.blank?
              Severity: Minor
              Found in app/lib/actions/katello/content_view_version/incremental_update.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