Sha256: cf906fb5bc62f6607809769513cda4e837953f46807c4a0347b490a2303ca25a

Contents?: true

Size: 766 Bytes

Versions: 5

Compression:

Stored size: 766 Bytes

Contents

# frozen_string_literal: true

require_relative 'base_conditions_filter'

module Gitlab
  module Triage
    module Filters
      class NoAdditionalLabelsConditionsFilter < BaseConditionsFilter
        def self.filter_parameters
          []
        end

        def validate_condition(condition)
          raise ArgumentError, 'condition must be an array containing the only label values allowed' unless condition.is_a?(Array)
        end

        def initialize_variables(expected_labels)
          @attribute = :labels
          @expected_labels = expected_labels
        end

        def resource_value
          @resource[@attribute]
        end

        def calculate
          (resource_value - @expected_labels).empty?
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gitlab-triage-1.44.1 lib/gitlab/triage/filters/no_additional_labels_conditions_filter.rb
gitlab-triage-1.44.0 lib/gitlab/triage/filters/no_additional_labels_conditions_filter.rb
gitlab-triage-1.43.2 lib/gitlab/triage/filters/no_additional_labels_conditions_filter.rb
gitlab-triage-1.43.1 lib/gitlab/triage/filters/no_additional_labels_conditions_filter.rb
gitlab-triage-1.43.0 lib/gitlab/triage/filters/no_additional_labels_conditions_filter.rb