Sha256: 1e9eb85953c15789e789a2d0456699436180c1cbb2138c89f34a56f0039f4cad

Contents?: true

Size: 756 Bytes

Versions: 32

Compression:

Stored size: 756 Bytes

Contents

require_relative 'base_conditions_filter'

module Gitlab
  module Triage
    module Filters
      class ForbiddenLabelsConditionsFilter < BaseConditionsFilter
        def validate_condition(condition)
          raise ArgumentError, 'condition must be an array containing forbidden label values' unless condition.is_a?(Array)
        end

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

        def resource_value
          @resource[@attribute]
        end

        def calculate
          label_intersection.empty?
        end

        private

        def label_intersection
          resource_value & @forbidden_labels
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
gitlab-triage-0.16.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-0.15.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-0.14.1 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-0.14.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-0.13.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-0.12.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-0.11.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-0.10.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-0.9.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-0.8.1 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-0.8.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-0.7.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb