Class: Gitlab::Dangerfiles::TypeLabelGuesser

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/dangerfiles/type_label_guesser.rb

Constant Summary collapse

CHANGELOG_CATEGORY_TO_TYPE_LABEL =
{
  fixed: %w[type::bug],
  security: %w[type::bug bug::vulnerability],
  performance: %w[type::bug bug::performance],
  added: %w[type::feature feature::addition],
  deprecated: %w[type::maintenance maintenance::removal],
  removed: %w[type::maintenance maintenance::removal]
}.freeze

Instance Method Summary collapse

Instance Method Details

#labels_from_changelog_categories(categories) ⇒ Object



15
16
17
18
19
20
# File 'lib/gitlab/dangerfiles/type_label_guesser.rb', line 15

def labels_from_changelog_categories(categories)
  categories = categories.map(&:to_sym) & CHANGELOG_CATEGORY_TO_TYPE_LABEL.keys
  return [] unless categories.one?

  CHANGELOG_CATEGORY_TO_TYPE_LABEL.fetch(categories.first.to_sym, [])
end