Sha256: 013aa804577eab92841cea18bcff2c619958cb63d4d3f0dd2bd5954888b169f5

Contents?: true

Size: 899 Bytes

Versions: 63

Compression:

Stored size: 899 Bytes

Contents

# frozen_string_literal: true

require_relative "../weightage"

module Gitlab
  module Dangerfiles
    module Weightage
      # @api private
      class Maintainers
        def initialize(maintainers)
          @maintainers = maintainers
        end

        def execute
          maintainers.each_with_object([]) do |maintainer, weighted_maintainers|
            add_weighted_reviewer(weighted_maintainers, maintainer, Gitlab::Dangerfiles::Weightage::BASE_REVIEWER_WEIGHT)
          end
        end

        private

        attr_reader :maintainers

        def add_weighted_reviewer(reviewers, reviewer, weight)
          if reviewer.reduced_capacity
            reviewers.fill(reviewer, reviewers.size, weight)
          else
            reviewers.fill(reviewer, reviewers.size, weight * Gitlab::Dangerfiles::Weightage::CAPACITY_MULTIPLIER)
          end
        end
      end
    end
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
gitlab-dangerfiles-4.8.0 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-4.7.0 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-4.6.0 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-4.5.1 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-4.4.0 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-4.3.2 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-4.2.1 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-4.2.0 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-4.1.0 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-4.0.0 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-3.13.0 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-3.12.0 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-3.11.0 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-3.10.0 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-3.9.0 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-3.8.0 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-3.7.0 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-3.6.7 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-3.6.6 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-3.6.5 lib/gitlab/dangerfiles/weightage/maintainers.rb