openSUSE/open-build-service

View on GitHub

Showing 336 of 425 total issues

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 validate_read_access_of_deleted_package has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
Open

  def validate_read_access_of_deleted_package(project, name)
    prj = Project.get_by_name(project)
    if prj.is_a?(Project)
      raise Project::ReadAccessError, project.to_s if prj.disabled_for?('access', nil, nil)
      raise Package::ReadSourceAccessError, "#{target_project_name}/#{target_package_name}" if prj.disabled_for?('sourceaccess', nil, nil)
Severity: Minor
Found in src/api/app/helpers/validation_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

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}"
              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

            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_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

      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

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

        def parse_one_diff(sourcediff)
          # Sort files into categories by their ending and add all of them to a hash. We
          # will later use the sorted and concatenated categories as key index into the per action file hash.
          changes_file_keys = []
          spec_file_keys = []
      Severity: Minor
      Found in src/api/app/mixins/parse_package_diff.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

                raise IllegalXpathError, 'attributes must be $NAMESPACE:$NAME' if tvalues.size != 2
      Severity: Minor
      Found in src/api/lib/xpath_engine.rb - About 45 mins to fix

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

          def update
            authorize @package, :update?
            @patchinfo = Patchinfo.new(patchinfo_params)
            if @patchinfo.valid?
              xml = @patchinfo.to_xml(@project, @package)
        Severity: Minor
        Found in src/api/app/controllers/webui/patchinfo_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

                elsif @last_key && @attribs[table][@last_key][:double]
                  @condition_values_needed.times { @condition_values << [value, value] }
                else
                  @condition_values_needed.times { @condition_values << value }
        Severity: Minor
        Found in src/api/lib/xpath_engine.rb - About 45 mins to fix

          Method rpmlint_result has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
          Confirmed

            def rpmlint_result
              @repo_arch_hash = {}
              @buildresult = Buildresult.find_hashed(project: @project.to_param, package: @package.to_param, view: 'status')
              repos = [] # Temp var
              if @buildresult
          Severity: Minor
          Found in src/api/app/controllers/webui/package_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

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

              def self.build_query_from_hash(hash, key_list = nil)
                key_list ||= hash.keys
                query = key_list.map do |key|
                  next unless hash.key?(key)
          
          
          Severity: Minor
          Found in src/api/app/lib/backend/connection.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
              # FIXME: Remove this statement when scmsync is fully supported
              if @project.scmsync.present?
                flash[:error] = "Package sources for project #{@project.name} are received through scmsync.
                                 This is not yet fully supported by the OBS frontend"
          Severity: Minor
          Found in src/api/app/controllers/webui/package_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

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

              def involved_packages_and_projects
                involved_items = []
                roles = roles_to_filter
          
                involved_items.concat(involved_items_as_owner) if filter_by_owner?
          Severity: Minor
          Found in src/api/app/services/user_service/involved.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

                    if qtype == :predicate
                      parse_predicate(root, stack[0])
                      stack.shift
                    elsif qtype.nil? || qtype == :qname
                      # just a plain existence test
          Severity: Minor
          Found in src/api/lib/xpath_engine.rb - About 45 mins to fix

            Method get_log_chunk has 6 arguments (exceeds 5 allowed). Consider refactoring.
            Open

              def get_log_chunk(project, package_name, repo, arch, start, theend)
            Severity: Minor
            Found in src/api/app/mixins/build_log_support.rb - About 35 mins to fix

              Method log_chunk has 6 arguments (exceeds 5 allowed). Consider refactoring.
              Open

                      def self.log_chunk(project_name, package_name, repository_name, architecture_name, starting_line, ending_line)
              Severity: Minor
              Found in src/api/app/lib/backend/api/build_results/status.rb - About 35 mins to fix

                Method branch has 6 arguments (exceeds 5 allowed). Consider refactoring.
                Open

                        def self.branch(target_project, target_package, source_project, source_package, user, options = {})
                Severity: Minor
                Found in src/api/app/lib/backend/api/sources/package.rb - About 35 mins to fix

                  Method info has 6 arguments (exceeds 5 allowed). Consider refactoring.
                  Open

                      def self.info(method, host, port, path, response, start_time)
                  Severity: Minor
                  Found in src/api/app/lib/backend/logger.rb - About 35 mins to fix

                    Method fileinfo_ext has 6 arguments (exceeds 5 allowed). Consider refactoring.
                    Open

                            def self.fileinfo_ext(project_name, package_name, repository, arch, filename, options = {})
                    Severity: Minor
                    Found in src/api/app/lib/backend/api/build_results/binaries.rb - About 35 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language