debian-mirror-gitlab/danger/specs/Dangerfile

17 lines
701 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
2019-12-21 20:55:43 +05:30
NO_SPECS_LABELS = %w[backstage documentation QA].freeze
2018-11-18 11:00:15 +05:30
NO_NEW_SPEC_MESSAGE = <<~MSG.freeze
You've made some app changes, but didn't add any tests.
That's OK as long as you're refactoring existing code,
but please consider adding any of the %<labels>s labels.
MSG
2018-12-13 13:39:08 +05:30
has_app_changes = !helper.all_changed_files.grep(%r{\A(ee/)?(app|lib|db/(geo/)?(post_)?migrate)/}).empty?
has_spec_changes = !helper.all_changed_files.grep(%r{\A(ee/)?spec/}).empty?
2018-11-18 11:00:15 +05:30
new_specs_needed = (gitlab.mr_labels & NO_SPECS_LABELS).empty?
if has_app_changes && !has_spec_changes && new_specs_needed
2020-05-24 23:13:21 +05:30
warn format(NO_NEW_SPEC_MESSAGE, labels: helper.labels_list(NO_SPECS_LABELS)), sticky: false
2018-11-18 11:00:15 +05:30
end