summaryrefslogtreecommitdiff
path: root/danger
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-20 13:18:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-20 13:18:24 +0000
commit0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch)
tree4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /danger
parent744144d28e3e7fddc117924fef88de5d9674fe4c (diff)
downloadgitlab-ce-0653e08efd039a5905f3fa4f6e9cef9f5d2f799c.tar.gz
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'danger')
-rw-r--r--danger/documentation/Dangerfile2
-rw-r--r--danger/karma/Dangerfile51
-rw-r--r--danger/metadata/Dangerfile8
3 files changed, 6 insertions, 55 deletions
diff --git a/danger/documentation/Dangerfile b/danger/documentation/Dangerfile
index 9bf425a5815..01ef5dbb49e 100644
--- a/danger/documentation/Dangerfile
+++ b/danger/documentation/Dangerfile
@@ -9,7 +9,7 @@ DOCUMENTATION_UPDATE_MISSING = <<~MSG
For more information, see:
-- The Handbook page on [merge request types](https://about.gitlab.com/handbook/engineering/metrics/#data-classification).
+- The Handbook page on [merge request types](https://about.gitlab.com/handbook/engineering/metrics/#work-type-classification).
- The [definition of done](https://docs.gitlab.com/ee/development/contributing/merge_request_workflow.html#definition-of-done) documentation.
MSG
diff --git a/danger/karma/Dangerfile b/danger/karma/Dangerfile
deleted file mode 100644
index e05bd86313f..00000000000
--- a/danger/karma/Dangerfile
+++ /dev/null
@@ -1,51 +0,0 @@
-# frozen_string_literal: true
-# rubocop:disable Style/SignalException
-
-def get_karma_files(files)
- files.select do |file|
- file.start_with?('ee/spec/javascripts', 'spec/javascripts') &&
- file.end_with?('_spec.js') &&
- !file.end_with?('browser_spec.js')
- end
-end
-
-new_karma_files = get_karma_files(git.added_files.to_a)
-
-unless new_karma_files.empty?
-
- if helper.ci?
- markdown(<<~MARKDOWN)
- ## New karma spec file
-
- New frontend specs ([except `browser_specs`](https://gitlab.com/gitlab-org/gitlab/blob/3b6fe2f1077eedb0b8aff02a7350234f0b7dc4f9/spec/javascripts/lib/utils/browser_spec.js#L2)) should be
- [written in jest](https://docs.gitlab.com/ee/development/testing_guide/frontend_testing.html#jest).
-
- You have created the following tests, please migrate them over to jest:
-
- * #{new_karma_files.map { |path| "`#{path}`" }.join("\n* ")}
- MARKDOWN
- end
-
- fail "You have created a new karma spec file"
-
-end
-
-changed_karma_files = get_karma_files(helper.all_changed_files) - new_karma_files
-
-return if changed_karma_files.empty?
-
-warn 'You have edited karma spec files. Please consider migrating them to jest.'
-
-if helper.ci?
- markdown(<<~MARKDOWN)
- ## Edited karma files
-
- You have edited the following karma spec files. Please consider migrating them to jest:
-
- * #{changed_karma_files.map { |path| "`#{path}`" }.join("\n* ")}
-
- In order to align with our Iteration value, migration can also be done as a follow-up.
-
- For more information: [Jestodus epic](https://gitlab.com/groups/gitlab-org/-/epics/895)
- MARKDOWN
-end
diff --git a/danger/metadata/Dangerfile b/danger/metadata/Dangerfile
index d2e85109d63..27dda687f6a 100644
--- a/danger/metadata/Dangerfile
+++ b/danger/metadata/Dangerfile
@@ -2,6 +2,8 @@
# rubocop:disable Style/SignalException
+DEFAULT_BRANCH = 'master'
+
THROUGHPUT_LABELS = [
'Community contribution',
'security',
@@ -29,12 +31,12 @@ end
has_milestone = !gitlab.mr_json["milestone"].nil?
-unless has_milestone
+unless has_milestone || (helper.security_mr? && gitlab.branch_for_base == DEFAULT_BRANCH)
warn "This merge request does not refer to an existing milestone.", sticky: false
end
has_pick_into_stable_label = gitlab.mr_labels.find { |label| label.start_with?('Pick into') }
-if gitlab.branch_for_base != "master" && !has_pick_into_stable_label && !helper.security_mr?
- warn "Most of the time, merge requests should target `master`. Otherwise, please set the relevant `Pick into X.Y` label."
+if gitlab.branch_for_base != DEFAULT_BRANCH && !has_pick_into_stable_label && !helper.security_mr?
+ warn "Most of the time, merge requests should target `#{DEFAULT_BRANCH}`. Otherwise, please set the relevant `Pick into X.Y` label."
end