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-1.10.1 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-1.10.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-1.9.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-1.8.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-1.7.1 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-1.7.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-1.6.1 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-1.6.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-1.5.1 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-1.5.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-1.4.2 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-1.4.1 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-1.4.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-1.3.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-1.2.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-1.1.1 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-1.1.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-1.0.1 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-1.0.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb
gitlab-triage-0.17.0 lib/gitlab/triage/filters/forbidden_labels_conditions_filter.rb