openSUSE/open-build-service

View on GitHub

Showing 336 of 425 total issues

Method change_state has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def change_state(opts)
    with_lock do
      permission_check_change_state!(opts)
      changestate_revoked(opts) if opts[:newstate] == 'revoked'
      changestate_accepted(opts) if opts[:newstate] == 'accepted'
Severity: Minor
Found in src/api/app/models/bs_request.rb - About 1 hr to fix

    Method update has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def update
        params[:user] = User.session!.login
        begin
          project = Project.get_by_name(@request_data['name'])
        rescue Project::UnknownObjectError
    Severity: Minor
    Found in src/api/app/controllers/source_project_meta_controller.rb - About 1 hr to fix

      Method branch_local_repositories has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def branch_local_repositories(project, pkg_to_enable, opts = {})
          # shall we use the repositories from a different project?
          project = project.update_instance_or_self('OBS', 'BranchRepositoriesFromProject')
          skip_repos = []
          a = project.find_attribute('OBS', 'BranchSkipRepositories')
      Severity: Minor
      Found in src/api/app/models/project.rb - About 1 hr to fix

        Method binary_packages has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def binary_packages
            check_package_access(params[:project], params[:package], false)
            @pkg = Package.find_by_project_and_name(params[:project], params[:package])
        
            begin
        Severity: Minor
        Found in src/api/app/controllers/public_controller.rb - About 1 hr to fix

          Method update_build_log has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def update_build_log
                  # Make sure objects don't contain invalid chars (eg. '../')
                  @repo = @project.repositories.find_by(name: params[:repository]).try(:name)
                  unless @repo
                    @errors = "Couldn't find repository '#{params[:repository]}'. We don't have build log for this repository"
          Severity: Minor
          Found in src/api/app/controllers/webui/packages/build_log_controller.rb - About 1 hr to fix

            Method parse_predicate has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def parse_predicate(root, stack)
                # logger.debug "------------------ predicate ---------------"
                # logger.debug "-- pred_array: #{stack.inspect} --"
            
                raise IllegalXpathError, 'invalid predicate' if stack.nil?
            Severity: Minor
            Found in src/api/lib/xpath_engine.rb - About 1 hr to fix

              Method evaluate_expr has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def evaluate_expr(expr, root, escape: false)
                  table = @base_table
                  a = []
                  until expr.empty?
                    token = expr.shift
              Severity: Minor
              Found in src/api/lib/xpath_engine.rb - About 1 hr to fix

                Method parse_develproject has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
                Open

                    def parse_develproject(xmlhash)
                      project.develproject = nil
                      devel = xmlhash['devel']
                      if devel
                        prj_name = devel['project']
                Severity: Minor
                Found in src/api/app/models/project/update_from_xml_command.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 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 set_repository_by_product has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
                Open

                  def set_repository_by_product(flag, status, product_name, patchlevel = nil)
                    validate_type flag
                
                    prj = self
                    prj = project if is_a?(Package)
                Severity: Minor
                Found in src/api/app/helpers/flag_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 _update_from_xml_register_pool has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def _update_from_xml_register_pool(rxml)
                    rxml.elements('pool') do |u|
                      medium = {}
                      product_media.each do |pm|
                        key = "#{pm.repository.id}/#{pm.name}"
                Severity: Minor
                Found in src/api/app/models/product.rb - About 1 hr to fix

                  Method validate has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def validate(opt, content)
                          case opt
                          when String, Symbol
                            schema_file = opt.to_s
                          when Hash, ActiveSupport::HashWithIndifferentAccess
                  Severity: Minor
                  Found in src/api/app/lib/suse/validator.rb - About 1 hr to fix

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

                      def render_xml(opts = {})
                        builder = Nokogiri::XML::Builder.new
                        builder.request(id: number, creator: creator) do |r|
                          bs_request_actions.includes([:bs_request_action_accept_info]).find_each do |action|
                            action.render_xml(r)
                    Severity: Minor
                    Found in src/api/app/models/bs_request.rb - About 1 hr to fix

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

                        def load_from_xml(patchinfo_xml)
                          self.binaries = []
                          patchinfo_xml.elements('binary').each do |binaries|
                            self.binaries << binaries
                          end
                      Severity: Minor
                      Found in src/api/app/models/patchinfo.rb - About 1 hr to fix

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

                            def subscriptions(channel = :instant_email)
                              receivers_and_subscriptions = {}
                        
                              event.class.receiver_roles.each do |receiver_role|
                                # Find the users/groups who are receivers for this event
                        Severity: Minor
                        Found in src/api/app/models/event_subscription/find_for_event.rb - About 1 hr to fix

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

                            def package_command
                              params[:user] = User.session!.login
                          
                              raise MissingParameterError, 'POST request without given cmd parameter' unless params[:cmd]
                          
                          
                          Severity: Minor
                          Found in src/api/app/controllers/source_controller.rb - About 1 hr to fix

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

                              def default_reviewers
                                reviews = []
                                return reviews unless target_project
                            
                                tprj = Project.get_by_name(target_project)
                            Severity: Minor
                            Found in src/api/app/models/bs_request_action.rb - About 1 hr to fix

                              Method call_diststats has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                    def call_diststats(bdep, jobs)
                                      @timings = {}
                                      @pngkey = Digest::MD5.hexdigest(params.to_s)
                                      @rebuildtime = 0
                              
                              
                              Severity: Minor
                              Found in src/api/app/controllers/webui/projects/rebuild_times_controller.rb - About 1 hr to fix

                                Method branch_copy_flags has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
                                Open

                                  def branch_copy_flags(project)
                                    # Copy the flags from the other project, adjusting them appropriately
                                    # for this one being a branch of it:
                                    #
                                    # - enable building
                                Severity: Minor
                                Found in src/api/app/models/project.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 perform has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
                                Open

                                  def perform
                                    if semaphore.locked?
                                      Rails.logger.debug 'skip lastnotifications, still locked'
                                      return
                                    end
                                Severity: Minor
                                Found in src/api/app/models/update_notification_events.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

                                Severity
                                Category
                                Status
                                Source
                                Language