yast/yast-yast2

View on GitHub
library/control/src/modules/WorkflowManager.rb

Summary

Maintainability
F
1 wk
Test Coverage

File WorkflowManager.rb has 1043 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "yast"
require "yast2/control_log_dir_rotator"

require "packages/package_downloader"
require "packages/package_extractor"
Severity: Major
Found in library/control/src/modules/WorkflowManager.rb - About 2 days to fix

    Class WorkflowManagerClass has 51 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class WorkflowManagerClass < Module
        include Yast::Logger
    
        def main
          Yast.import "UI"
    Severity: Major
    Found in library/control/src/modules/WorkflowManager.rb - About 7 hrs to fix

      Method UpdateWorkflows has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def UpdateWorkflows(workflows, prod_name, domain)
            workflows = deep_copy(workflows)
            Builtins.foreach(workflows) do |workflow|
              stage = Ops.get_string(workflow, "stage", "")
              mode = Ops.get_string(workflow, "mode", "")
      Severity: Minor
      Found in library/control/src/modules/WorkflowManager.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 ReplaceProposalModule has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def ReplaceProposalModule(proposal, old, new)
            proposal = deep_copy(proposal)
            new = deep_copy(new)
            found = false
      
      
      Severity: Minor
      Found in library/control/src/modules/WorkflowManager.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 control_file has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def control_file(source)
            package = case source
            when ::Integer
              product = find_product(source)
              return nil unless product&.product_package
      Severity: Minor
      Found in library/control/src/modules/WorkflowManager.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 Replaceworkflows has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def Replaceworkflows(workflows)
            workflows = deep_copy(workflows)
            workflows = PrepareWorkflows(workflows)
      
            # This function doesn't update the current workflow but replaces it.
      Severity: Major
      Found in library/control/src/modules/WorkflowManager.rb - About 2 hrs to fix

        Method MergeProposal has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def MergeProposal(base, additional_control, prod_name, domain)
              base = deep_copy(base)
              additional_control = deep_copy(additional_control)
              # Additional proposal settings - Replacing items
              replaces = Builtins.listmap(
        Severity: Minor
        Found in library/control/src/modules/WorkflowManager.rb - About 2 hrs to fix

          Method UpdateProposals has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def UpdateProposals(proposals, prod_name, domain)
                proposals = deep_copy(proposals)
                Builtins.foreach(proposals) do |proposal|
                  name = Ops.get_string(proposal, "name", "")
                  stage = Ops.get_string(proposal, "stage", "")
          Severity: Minor
          Found in library/control/src/modules/WorkflowManager.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 MergeWorkflow has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def MergeWorkflow(base, addon, _prod_name, domain)
                base = deep_copy(base)
                addon = deep_copy(addon)
          
                log.info "merging workflow #{addon.inspect} to #{base.inspect}"
          Severity: Minor
          Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

            Method UpdateWorkflows has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def UpdateWorkflows(workflows, prod_name, domain)
                  workflows = deep_copy(workflows)
                  Builtins.foreach(workflows) do |workflow|
                    stage = Ops.get_string(workflow, "stage", "")
                    mode = Ops.get_string(workflow, "mode", "")
            Severity: Minor
            Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

              Method MergeWorkflows has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def MergeWorkflows
                    Builtins.y2milestone("Merging additional control files from scratch...")
                    @unmerged_changes = false
              
                    # Init the Base Workflow settings
              Severity: Minor
              Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

                Method UpdateProposals has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def UpdateProposals(proposals, prod_name, domain)
                      proposals = deep_copy(proposals)
                      Builtins.foreach(proposals) do |proposal|
                        name = Ops.get_string(proposal, "name", "")
                        stage = Ops.get_string(proposal, "stage", "")
                Severity: Minor
                Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

                  Method IntegrateWorkflow has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def IntegrateWorkflow(filename)
                        Builtins.y2milestone("IntegrateWorkflow %1", filename)
                  
                        begin
                          update_file = XML.XMLToYCPFile(filename)
                  Severity: Minor
                  Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

                    Method ReplaceProposalModule has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def ReplaceProposalModule(proposal, old, new)
                          proposal = deep_copy(proposal)
                          new = deep_copy(new)
                          found = false
                    
                    
                    Severity: Minor
                    Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

                      Method main has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def main
                            Yast.import "UI"
                            Yast.import "Pkg"
                      
                            textdomain "base"
                      Severity: Minor
                      Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

                        Method UpdateProductInfo has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def UpdateProductInfo(update_file, _filename)
                              update_file = deep_copy(update_file)
                              # merging all 'map <string, any>' type
                              Builtins.foreach(["globals", "software", "partitioning", "network"]) do |section|
                                sect = ProductFeatures.GetSection(section)
                        Severity: Minor
                        Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

                          Method StoreWorkflowFile has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def StoreWorkflowFile(file_from, file_to)
                                if file_from.nil? || file_from == "" || file_to.nil? || file_to == ""
                                  Builtins.y2error("Cannot copy '%1' to '%2'", file_from, file_to)
                                  return nil
                                end
                          Severity: Minor
                          Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

                            Method RemoveWorkflow has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def RemoveWorkflow(type, src_id, name)
                                  Builtins.y2milestone(
                                    "Removing Workflow:  Type %1, ID %2, Name %3",
                                    type,
                                    src_id,
                            Severity: Minor
                            Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

                              Method PrepareWorkflows has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  def PrepareWorkflows(workflows)
                                    workflows = deep_copy(workflows)
                                    new_workflows = []
                              
                                    # Going through all workflows
                              Severity: Minor
                              Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

                                Method control_file has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def control_file(source)
                                      package = case source
                                      when ::Integer
                                        product = find_product(source)
                                        return nil unless product&.product_package
                                Severity: Minor
                                Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

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

                                      def find_control_package(release_package)
                                        return nil unless release_package&.deps
                                  
                                        release_package.deps.each do |dep|
                                          provide = dep["provides"]
                                  Severity: Minor
                                  Found in library/control/src/modules/WorkflowManager.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 PrepareProposals has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      def PrepareProposals(proposals)
                                        proposals = deep_copy(proposals)
                                        new_proposals = []
                                  
                                        # Going through all proposals
                                  Severity: Minor
                                  Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

                                    Method GetCachedWorkflowFilename has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        def GetCachedWorkflowFilename(type, src_id, name = "")
                                          if ![:package, :addon].include?(type)
                                            Builtins.y2error("Unknown workflow type: %1", type)
                                            return nil
                                          end
                                    Severity: Minor
                                    Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

                                      Method GetCachedWorkflowFilename has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def GetCachedWorkflowFilename(type, src_id, name = "")
                                            if ![:package, :addon].include?(type)
                                              Builtins.y2error("Unknown workflow type: %1", type)
                                              return nil
                                            end
                                      Severity: Minor
                                      Found in library/control/src/modules/WorkflowManager.rb - About 55 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 PrepareProposals has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def PrepareProposals(proposals)
                                            proposals = deep_copy(proposals)
                                            new_proposals = []
                                      
                                            # Going through all proposals
                                      Severity: Minor
                                      Found in library/control/src/modules/WorkflowManager.rb - About 55 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 PrepareWorkflows has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def PrepareWorkflows(workflows)
                                            workflows = deep_copy(workflows)
                                            new_workflows = []
                                      
                                            # Going through all workflows
                                      Severity: Minor
                                      Found in library/control/src/modules/WorkflowManager.rb - About 55 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 RemoveWorkflow has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def RemoveWorkflow(type, src_id, name)
                                            Builtins.y2milestone(
                                              "Removing Workflow:  Type %1, ID %2, Name %3",
                                              type,
                                              src_id,
                                      Severity: Minor
                                      Found in library/control/src/modules/WorkflowManager.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 MergeWorkflows has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def MergeWorkflows
                                            Builtins.y2milestone("Merging additional control files from scratch...")
                                            @unmerged_changes = false
                                      
                                            # Init the Base Workflow settings
                                      Severity: Minor
                                      Found in library/control/src/modules/WorkflowManager.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 MergeProposal has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def MergeProposal(base, additional_control, prod_name, domain)
                                            base = deep_copy(base)
                                            additional_control = deep_copy(additional_control)
                                            # Additional proposal settings - Replacing items
                                            replaces = Builtins.listmap(
                                      Severity: Minor
                                      Found in library/control/src/modules/WorkflowManager.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 ReplaceWorkflowModule has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                          def ReplaceWorkflowModule(workflow, old, new, domain, keep)
                                      Severity: Minor
                                      Found in library/control/src/modules/WorkflowManager.rb - About 35 mins to fix

                                        Method StoreWorkflowFile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            def StoreWorkflowFile(file_from, file_to)
                                              if file_from.nil? || file_from == "" || file_to.nil? || file_to == ""
                                                Builtins.y2error("Cannot copy '%1' to '%2'", file_from, file_to)
                                                return nil
                                              end
                                        Severity: Minor
                                        Found in library/control/src/modules/WorkflowManager.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

                                        Avoid too many return statements within this method.
                                        Open

                                                return false
                                        Severity: Major
                                        Found in library/control/src/modules/WorkflowManager.rb - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                  return false
                                          Severity: Major
                                          Found in library/control/src/modules/WorkflowManager.rb - About 30 mins to fix

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

                                                def ReplaceWorkflowModule(workflow, old, new, domain, keep)
                                                  workflow = deep_copy(workflow)
                                                  new = deep_copy(new)
                                                  found = false
                                            
                                            
                                            Severity: Minor
                                            Found in library/control/src/modules/WorkflowManager.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 IntegrateWorkflow has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                def IntegrateWorkflow(filename)
                                                  Builtins.y2milestone("IntegrateWorkflow %1", filename)
                                            
                                                  begin
                                                    update_file = XML.XMLToYCPFile(filename)
                                            Severity: Minor
                                            Found in library/control/src/modules/WorkflowManager.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 package_repository has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                def package_repository(package_name)
                                                  # Identify the installation repository with the package
                                                  pkgs = Y2Packager::Resolvable.find(kind: :package, name: package_name)
                                            
                                                  if pkgs.empty?
                                            Severity: Minor
                                            Found in library/control/src/modules/WorkflowManager.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

                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                            Open

                                                  inserts = Builtins.listmap(Ops.get_list(addon, "insert_modules", [])) do |i|
                                                    before = Ops.get_string(i, "before", "")
                                                    new = Ops.get_list(i, "modules", [])
                                                    { before => new }
                                            Severity: Minor
                                            Found in library/control/src/modules/WorkflowManager.rb and 2 other locations - About 15 mins to fix
                                            library/control/src/modules/WorkflowManager.rb on lines 740..745
                                            library/control/src/modules/WorkflowManager.rb on lines 906..909

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 26.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                            Open

                                                  replaces = Builtins.listmap(Ops.get_list(addon, "replace_modules", [])) do |a|
                                                    old = Ops.get_string(a, "replace", "")
                                                    new = Ops.get_list(a, "modules", [])
                                                    { old => new }
                                            Severity: Minor
                                            Found in library/control/src/modules/WorkflowManager.rb and 2 other locations - About 15 mins to fix
                                            library/control/src/modules/WorkflowManager.rb on lines 740..745
                                            library/control/src/modules/WorkflowManager.rb on lines 920..923

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 26.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                            Open

                                                  replaces = Builtins.listmap(
                                                    Ops.get_list(additional_control, "replace_modules", [])
                                                  ) do |one_addon|
                                                    old = Ops.get_string(one_addon, "replace", "")
                                                    new = Ops.get_list(one_addon, "modules", [])
                                            Severity: Minor
                                            Found in library/control/src/modules/WorkflowManager.rb and 2 other locations - About 15 mins to fix
                                            library/control/src/modules/WorkflowManager.rb on lines 906..909
                                            library/control/src/modules/WorkflowManager.rb on lines 920..923

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 26.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            There are no issues that match your filters.

                                            Category
                                            Status