openSUSE/open-build-service

View on GitHub

Showing 342 of 432 total issues

Method put_userinfo has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def put_userinfo
    login = params[:login]
    user = User.find_by_login(login) if login

    unless ::Configuration.accounts_editable?(user)
Severity: Minor
Found in src/api/app/controllers/person_controller.rb - About 1 hr to fix

    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 notifiable_link_path has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def notifiable_link_path
            case @notification.event_type
            when 'Event::RequestStatechange', 'Event::RequestCreate', 'Event::ReviewWanted'
              Rails.application.routes.url_helpers.request_show_path(@notification.notifiable.number, notification_id: @notification.id)
            when 'Event::CommentForRequest'
        Severity: Minor
        Found in src/api/app/components/notification_notifiable_link_component.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 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 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 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 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 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 post_userinfo has a Cognitive Complexity of 16 (exceeds 8 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

                    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 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 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 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
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language