openSUSE/open-build-service

View on GitHub
src/api/app/helpers/maintenance_helper.rb

Summary

Maintainability
D
1 day
Test Coverage
A
96%

Method instantiate_container has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def instantiate_container(project, opackage, opts = {})
    opkg = opackage.origin_container
    pkg_name = opkg_name = opkg.name
    if opkg.is_a?(Package) && opkg.project.is_maintenance_release?
      # strip incident suffix
Severity: Major
Found in src/api/app/helpers/maintenance_helper.rb - About 2 hrs to fix

    Method copy_binaries has a Cognitive Complexity of 20 (exceeds 8 allowed). Consider refactoring.
    Open

      def copy_binaries(filter_source_repository, filter_architecture, source_package, target_package_name,
                        target_project, multibuild_container, setrelease, manual)
        update_ids = []
        source_package.project.repositories.each do |source_repo|
          next if filter_source_repository && filter_source_repository != source_repo
    Severity: Minor
    Found in src/api/app/helpers/maintenance_helper.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 release_package has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
    Open

      def release_package(source_package, target, target_package_name, opts = {})
        filter_source_repository = opts[:filter_source_repository]
        filter_architecture      = opts[:filter_architecture]
        multibuild_container     = opts[:multibuild_container]
        action                   = opts[:action]
    Severity: Minor
    Found in src/api/app/helpers/maintenance_helper.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 instantiate_container has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
    Open

      def instantiate_container(project, opackage, opts = {})
        opkg = opackage.origin_container
        pkg_name = opkg_name = opkg.name
        if opkg.is_a?(Package) && opkg.project.is_maintenance_release?
          # strip incident suffix
    Severity: Minor
    Found in src/api/app/helpers/maintenance_helper.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 release_package has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def release_package(source_package, target, target_package_name, opts = {})
        filter_source_repository = opts[:filter_source_repository]
        filter_architecture      = opts[:filter_architecture]
        multibuild_container     = opts[:multibuild_container]
        action                   = opts[:action]
    Severity: Minor
    Found in src/api/app/helpers/maintenance_helper.rb - About 1 hr to fix

      Method get_updateinfo_id has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
      Open

        def get_updateinfo_id(source_package, target_repo)
          return unless source_package.is_patchinfo?
      
          # check for patch name inside of _patchinfo file
          xml = Patchinfo.new.read_patchinfo_xmlhash(source_package)
      Severity: Minor
      Found in src/api/app/helpers/maintenance_helper.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 release_package_create_main_package has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def release_package_create_main_package(request, source_package, target_package_name, target_project)
          base_package_name = target_package_name.gsub(/\.[^.]*$/, '')
      
          # only if package does not contain a _patchinfo file
          lpkg = nil
      Severity: Minor
      Found in src/api/app/helpers/maintenance_helper.rb - About 1 hr to fix

        Method import_channel has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
        Open

          def import_channel(channel, pkg, target_repo = nil)
            channel = REXML::Document.new(channel)
        
            channel.elements['/channel'].add_element 'target', 'project' => target_repo.project.name, 'repository' => target_repo.name if target_repo
        
        
        Severity: Minor
        Found in src/api/app/helpers/maintenance_helper.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 copy_binaries has 8 arguments (exceeds 5 allowed). Consider refactoring.
        Open

          def copy_binaries(filter_source_repository, filter_architecture, source_package, target_package_name,
                            target_project, multibuild_container, setrelease, manual)
        Severity: Major
        Found in src/api/app/helpers/maintenance_helper.rb - About 50 mins to fix

          Method copy_single_binary has 8 arguments (exceeds 5 allowed). Consider refactoring.
          Open

            def copy_single_binary(arch, target_repository, source_project_name, source_package_name, source_repo,
                                   target_package_name, update_info_id, setrelease)
          Severity: Major
          Found in src/api/app/helpers/maintenance_helper.rb - About 50 mins to fix

            Method copy_binaries_to_repository has 7 arguments (exceeds 5 allowed). Consider refactoring.
            Open

              def copy_binaries_to_repository(source_repository, filter_architecture, source_package, target_repo, target_package_name,
                                              multibuild_container, setrelease)
            Severity: Major
            Found in src/api/app/helpers/maintenance_helper.rb - About 45 mins to fix

              Method copy_binaries_to_repository has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
              Open

                def copy_binaries_to_repository(source_repository, filter_architecture, source_package, target_repo, target_package_name,
                                                multibuild_container, setrelease)
                  # get updateinfo id in case the source package comes from a maintenance project
                  u_id = get_updateinfo_id(source_package, target_repo)
                  source_package_name = source_package.name
              Severity: Minor
              Found in src/api/app/helpers/maintenance_helper.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