Sha256: abfbbbb954223d3e6afe676676a3f2f97418512930760cd69cf9f5897a881f78

Contents?: true

Size: 878 Bytes

Versions: 9

Compression:

Stored size: 878 Bytes

Contents

# frozen_string_literal: true

require_relative "../weightage"

module Gitlab
  module Dangerfiles
    module Weightage
      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

9 entries across 9 versions & 1 rubygems

Version Path
gitlab-dangerfiles-1.1.1 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-1.1.0 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-1.0.0 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-0.9.0 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-0.8.1 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-0.8.0 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-0.7.0 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-0.6.1 lib/gitlab/dangerfiles/weightage/maintainers.rb
gitlab-dangerfiles-0.6.0 lib/gitlab/dangerfiles/weightage/maintainers.rb