openSUSE/open-build-service

View on GitHub

Showing 395 of 429 total issues

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

            def changestate_accepted(opts)
              # all maintenance_incident actions go into the same incident project
              incident_project = nil # .where(type: 'maintenance_incident')
              bs_request_actions.each do |action|
                source_project = Project.find_by_name(action.source_project)
          Severity: Minor
          Found in src/api/app/models/bs_request.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 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

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

            def check_for_expand_errors!(add_revision)
              return unless action_type.in?(%i[submit release maintenance_incident maintenance_release])
          
              # validate that the sources are not broken
              begin
          Severity: Minor
          Found in src/api/app/models/bs_request_action.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 start has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
          Open

              def self.start(options = {})
                return unless Rails.env.test?
                return if @backend
                return if ENV['BACKEND_STARTED']
          
          
          Severity: Minor
          Found in src/api/app/lib/backend/test.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 rdiff has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
          Open

            def rdiff
              @last_rev = @package.dir_hash['rev']
              @linkinfo = @package.linkinfo
              if params[:oproject]
                @oproject = ::Project.find_by_name(params[:oproject])
          Severity: Minor
          Found in src/api/app/controllers/webui/package_controller.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 post_userinfo has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def post_userinfo
              authorize @user, :update?
          
              login = params[:login]
              # just for permission checking
          Severity: Minor
          Found in src/api/app/controllers/person_controller.rb - About 1 hr to fix

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

              def check_action_permission!(skip_source = nil)
                # find objects if specified or report error
                role = nil
                sprj = nil
                if person_name
            Severity: Minor
            Found in src/api/app/models/bs_request_action.rb - About 1 hr to fix

              Method show has 34 lines of code (exceeds 25 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 1 hr to fix

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

                  def update
                    @configuration = ::Configuration.fetch
                
                    xml = Xmlhash.parse(request.raw_post) || {}
                    attribs = {}
                Severity: Minor
                Found in src/api/app/controllers/configurations_controller.rb - About 1 hr to fix

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

                    def render_xml
                      builder = Nokogiri::XML::Builder.new
                      builder.binary(render_attributes) do |binary|
                        binary.operation(operation)
                  
                  
                  Severity: Minor
                  Found in src/api/app/models/binary_release.rb - About 1 hr to fix

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

                          def show
                            logger.info("Statistics for RebuildTimesController#show: #{User.possibly_nobody.login}")
                            @repository = params[:repository]
                            @arch = params[:arch]
                            @hosts = (params[:hosts] || 40).to_i
                    Severity: Minor
                    Found in src/api/app/controllers/webui/projects/rebuild_times_controller.rb - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                          if Flipper.enabled?(:request_show_redesign, User.session)
                            @history_elements = @bs_request.history_elements.includes(:user)
                            @active_tab = 'conversation'
                            render :beta_show
                          else
                      Severity: Critical
                      Found in src/api/app/controllers/webui/request_controller.rb - About 1 hr to fix

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

                          def update_from_xml(xmlhash)
                            with_lock do
                              self.email = xmlhash.value('email')
                            end
                            save!
                        Severity: Minor
                        Found in src/api/app/models/group.rb - About 1 hr to fix

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

                                def build
                                  # the target is by default the _link target
                                  # maintenance_release creates new packages instance, but are changing the source only according to the link
                                  provided_in_other_action = check_for_local_linked_packages(source_package)
                                  # fallback name as last resort
                          Severity: Minor
                          Found in src/api/app/models/bs_request_action/differ/query_builder.rb - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language