openSUSE/open-build-service

View on GitHub

Showing 396 of 431 total issues

Method update_from_xml has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
Open

  def update_from_xml(xmlhash, ignore_lock = nil)
    check_write_access!(ignore_lock)

    Package.transaction do
      self.title = xmlhash.value('title')
Severity: Minor
Found in src/api/app/models/package.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 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 parse_status has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
    Open

      def parse_status(project_name, package)
        comments_to_clear = []
        outs = []
        sortkey = "9-ok-#{package['name']}"
        age = age_from_devel(package['develmtime'].to_i)
    Severity: Minor
    Found in src/api/app/helpers/webui/projects/status_helper.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 update_file has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
    Open

      def update_file
        check_permissions_for_file
    
        raise PutFileNoPermission, "Insufficient permissions to store file in package #{@package_name}, project #{@project_name}" unless @allowed
    
    
    Severity: Minor
    Found in src/api/app/controllers/source_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

    Avoid deeply nested control flow statements.
    Open

                       missing_ok_link = true if data_linkinfo['missingok']
    Severity: Minor
    Found in src/api/app/models/bs_request_action.rb - About 45 mins to fix

      Method find_assignees has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
      Open

          def find_assignees(binary_name)
            projects = @rootproject.expand_all_projects
      
            # binary search via all projects
            data = Xmlhash.parse(Backend::Api::Search.binary(projects.map(&:name), binary_name))
      Severity: Minor
      Found in src/api/app/models/owner_search/assignee.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 show has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
      Open

        def show
          project_name = params[:project]
          if params.key?(:deleted)
            unless Project.find_by_name(project_name) || Project.is_remote_project?(project_name)
              # project is deleted or not accessible
      Severity: Minor
      Found in src/api/app/controllers/source_project_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

      Avoid deeply nested control flow statements.
      Confirmed

                unless link_is_already_devel
                  action[:forward] ||= []
                  action[:forward] << { project: linkinfo['project'], package: linkinfo['package'], type: 'link' }
                end
      Severity: Minor
      Found in src/api/app/models/bs_request.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Confirmed

                  target = if tpkg
                             Package.find_by_project_and_name(tprj, tpkg)
                           else
                             Project.find_by_name(tprj)
                           end
        Severity: Minor
        Found in src/api/app/controllers/webui/request_controller.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Confirmed

                  raise 'We should have expanded a target_project' unless target_project
          Severity: Minor
          Found in src/api/app/models/bs_request_action.rb - About 45 mins to fix

            Method update_product_list has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
            Open

              def update_product_list
                # short cut to ensure that no products are left over
                unless is_product?
                  products.destroy_all
                  return
            Severity: Minor
            Found in src/api/app/models/package.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 add_channels has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
            Open

              def add_channels(mode = :add_disabled)
                raise InvalidParameterError unless %i[add_disabled skip_disabled enable_all].include?(mode)
                return if is_channel?
            
                opkg = origin_container(local: false)
            Severity: Minor
            Found in src/api/app/models/package.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 write_to_backend has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
            Open

              def write_to_backend
                reset_cache
                raise ArgumentError, 'no commit_user set' unless commit_user
                raise InvalidParameterError, 'Project meta file can not be written via package model' if name == '_project'
            
            
            Severity: Minor
            Found in src/api/app/models/package.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

            Avoid deeply nested control flow statements.
            Confirmed

                    raise IllegalRequest, 'Maintenance requests accept only projects as target' if target_package
            Severity: Minor
            Found in src/api/app/models/bs_request_action.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Confirmed

                        target.add_maintainer(@bs_request.creator) if target.can_be_modified_by?(User.possibly_nobody)
              Severity: Minor
              Found in src/api/app/controllers/webui/request_controller.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Confirmed

                        next if reviews.any? { |a| a.by_project == r.name && a.by_package.nil? }
                Severity: Minor
                Found in src/api/app/models/bs_request.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Confirmed

                              unless allowed
                                render_error status: 403, errorcode: 'execute_cmd_no_permission',
                                             message: "No permission to execute command on package #{pack_name} in project #{prj.name}"
                                return
                              end
                  Severity: Minor
                  Found in src/api/app/controllers/build_controller.rb - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Confirmed

                          elsif r.instance_of?(Package)
                            next if reviews.any? { |a| a.by_project == r.project.name && a.by_package == r.name }
                    
                            reviews.new(by_project: r.project.name, by_package: r.name, state: :new)
                          else
                    Severity: Minor
                    Found in src/api/app/models/bs_request.rb - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                              raise IncidentHasNoMaintenanceProject, 'incident projects shall only create below maintenance projects' unless prj.kind.in?(%w[maintenance maintenance_incident])
                      Severity: Minor
                      Found in src/api/app/models/bs_request_action.rb - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Confirmed

                                self.makeoriginolder = true if tprj.attribs.find_by(attrib_type: at)
                        Severity: Minor
                        Found in src/api/app/models/bs_request_action.rb - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language