2018-10-23 10:27:25 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-10-04 05:06:35 -04:00
|
|
|
NO_SPECS_LABELS = %w[backstage documentation QA].freeze
|
2018-07-11 15:44:35 -04:00
|
|
|
NO_NEW_SPEC_MESSAGE = <<~MSG.freeze
|
2018-07-10 06:10:54 -04:00
|
|
|
You've made some app changes, but didn't add any tests.
|
|
|
|
That's OK as long as you're refactoring existing code,
|
2018-07-16 13:23:45 -04:00
|
|
|
but please consider adding any of the %<labels>s labels.
|
2018-07-10 06:10:54 -04:00
|
|
|
MSG
|
|
|
|
|
2018-10-23 10:27:25 -04:00
|
|
|
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-07-16 13:23:45 -04:00
|
|
|
new_specs_needed = (gitlab.mr_labels & NO_SPECS_LABELS).empty?
|
2018-05-21 12:41:21 -04:00
|
|
|
|
2018-07-16 13:23:45 -04:00
|
|
|
if has_app_changes && !has_spec_changes && new_specs_needed
|
2020-04-28 14:09:35 -04:00
|
|
|
warn format(NO_NEW_SPEC_MESSAGE, labels: helper.labels_list(NO_SPECS_LABELS)), sticky: false
|
2018-05-21 12:41:21 -04:00
|
|
|
end
|