openSUSE/open-build-service

View on GitHub

Showing 339 of 429 total issues

Method statistic has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def statistic
      result = backend_statistics
      return if result.blank?

      disk = result.dig('disk', 'usage')
Severity: Minor
Found in src/api/app/models/local_build_statistic/for_package.rb - About 1 hr to fix

    Method update_generic_relationships has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def update_generic_relationships(xmlhash)
        # we remember the current relationships in a hash
        cache = {}
        relationships.each do |purr|
          next if @updater.ignore?(purr)
    Severity: Minor
    Found in src/api/app/models/concerns/has_relationships.rb - About 1 hr to fix

      Method extend_packages_to_link has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def extend_packages_to_link(p)
          return unless p[:package].is_a?(Package) # only for local packages
      
          pkg = p[:package]
          if pkg.is_link?
      Severity: Minor
      Found in src/api/app/models/branch_package.rb - About 1 hr to fix

        Method create_events has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def create_events
            Event::Base.transaction do
              data = type = nil
              @last.elements('notification') do |e|
                type = e['type']
        Severity: Minor
        Found in src/api/app/models/update_notification_events.rb - About 1 hr to fix

          Method forward has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def forward
              forward_object = nil
              target_package_object = Package.find_by_project_and_name(target_project, target_package)
          
              if target_package_object
          Severity: Minor
          Found in src/api/app/models/bs_request_action_submit.rb - About 1 hr to fix

            Method has_local_permission? has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def has_local_permission?(perm_string, object)
                roles = Role.ids_with_permission(perm_string)
                return false unless roles
            
                parent = nil
            Severity: Minor
            Found in src/api/app/models/user.rb - About 1 hr to fix

              Method description_text has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def description_text
                  case @notification.event_type
                  when 'Event::RequestStatechange', 'Event::RequestCreate', 'Event::ReviewWanted', 'Event::CommentForRequest'
                    BsRequestActionSourceAndTargetComponent.new(bs_request).call
                  when 'Event::CommentForProject'
              Severity: Minor
              Found in src/api/app/components/notification_action_description_component.rb - About 1 hr to fix

                Method run has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def run(xmlhash, force = nil)
                      project.check_write_access!
                
                      # check for raising read access permissions, which can't get ensured atm
                      raise ForbiddenError if !(project.new_record? || project.disabled_for?('access', nil, nil)) && (FlagHelper.xml_disabled_for?(xmlhash, 'access') && !User.admin_session?)
                Severity: Minor
                Found in src/api/app/models/project/update_from_xml_command.rb - About 1 hr to fix

                  Method branch_remote_repositories has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def branch_remote_repositories(project)
                      remote_project = Project.new(name: project)
                      remote_project_meta = Nokogiri::XML(remote_project.meta.content, &:strict)
                      local_project_meta = Nokogiri::XML(render_xml, &:strict)
                  
                  
                  Severity: Minor
                  Found in src/api/app/models/project.rb - About 1 hr to fix

                    Method resample has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def self.resample(values, samples = 400)
                        values.sort_by! { |a| a[0] }
                    
                        result = []
                        return result if values.empty?
                    Severity: Minor
                    Found in src/api/app/helpers/status_helper.rb - About 1 hr to fix

                      Method release_package_create_main_package has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def release_package_create_main_package(request, source_package, target_package_name, target_project)
                          base_package_name = target_package_name.gsub(/\.[^.]*$/, '')
                      
                          # only if package does not contain a _patchinfo file
                          lpkg = nil
                      Severity: Minor
                      Found in src/api/app/helpers/maintenance_helper.rb - About 1 hr to fix

                        Method index has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def index
                            if request.post? && !params[:project].nil? && Project.valid_name?(params[:project])
                              redirect_to project: params[:project]
                            else
                              begin
                        Severity: Minor
                        Found in src/api/app/controllers/webui/monitor_controller.rb - About 1 hr to fix

                          Method create has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                def create
                                  authorize @package, :update?
                          
                                  files = params[:files] || []
                                  filename = params[:filename]
                          Severity: Minor
                          Found in src/api/app/controllers/webui/packages/files_controller.rb - About 1 hr to fix

                            Method forbidden_project_ids has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
                            Open

                              def self.forbidden_project_ids
                                # Admins don't have forbidden projects
                                return [0] if User.admin_session?
                            
                                # This will cache and return a hash like this:
                            Severity: Minor
                            Found in src/api/app/models/relationship.rb - About 55 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 create_events has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
                            Open

                              def create_events
                                Event::Base.transaction do
                                  data = type = nil
                                  @last.elements('notification') do |e|
                                    type = e['type']
                            Severity: Minor
                            Found in src/api/app/models/update_notification_events.rb - About 55 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_jobhistory has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
                            Open

                                def update_jobhistory(proj, mypackages)
                                  prjpacks = {}
                                  dname = proj.name
                                  mypackages.each_value do |package|
                                    prjpacks[package.name] = package if package.project == dname
                            Severity: Minor
                            Found in src/api/app/models/project_status/calculator.rb - About 55 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 obsolete_reviews has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
                            Open

                              def obsolete_reviews(opts)
                                return false unless opts[:by_user] || opts[:by_group] || opts[:by_project] || opts[:by_package]
                            
                                reviews.each do |review|
                                  next unless review.reviewable_by?(opts)
                            Severity: Minor
                            Found in src/api/app/models/bs_request.rb - About 55 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_repository_xml_attribute has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
                            Open

                                def validate_repository_xml_attribute(request_data, project_name)
                                  # Check used repo pathes for existence and read access permissions
                                  request_data.elements('repository') do |repository|
                                    repository.elements('path') do |element|
                                      # permissions check
                            Severity: Minor
                            Found in src/api/app/models/project.rb - About 55 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 set_flags has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
                            Open

                              def set_flags
                                ActiveRecord::Base.transaction do
                                  objects_to_store = Set.new
                                  flags.each do |flag|
                                    main_object = project_or_package(flag)
                            Severity: Minor
                            Found in src/api/app/models/workflow/step/set_flags.rb - About 55 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 import_channel has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
                            Open

                              def import_channel(channel, pkg, target_repo = nil)
                                channel = REXML::Document.new(channel)
                            
                                channel.elements['/channel'].add_element 'target', 'project' => target_repo.project.name, 'repository' => target_repo.name if target_repo
                            
                            
                            Severity: Minor
                            Found in src/api/app/helpers/maintenance_helper.rb - About 55 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

                            Severity
                            Category
                            Status
                            Source
                            Language