Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/danger
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-07 12:09:13 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-07 12:09:13 +0300
commit419f9c0ac3ae842964cc191932cab795463b259c (patch)
tree3441a3fb215f89997d0acc482fe5ae047d2ee3d7 /danger
parentb6724a211e047c35f3ba4c294997fba14bf42445 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'danger')
-rw-r--r--danger/pajamas/Dangerfile37
1 files changed, 28 insertions, 9 deletions
diff --git a/danger/pajamas/Dangerfile b/danger/pajamas/Dangerfile
index 34dcbc21941..d60582b0bc9 100644
--- a/danger/pajamas/Dangerfile
+++ b/danger/pajamas/Dangerfile
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+# rubocop:disable Style/SignalException
PATTERNS = %w[
createFlash
@@ -12,6 +13,9 @@ PATTERNS = %w[
initDeprecatedJQueryDropdown
].freeze
+BLOCKING_PATTERNS = %w[
+].freeze
+
def get_added_lines(files)
lines = []
files.each do |file|
@@ -25,19 +29,34 @@ changed_vue_haml_files = helper.changed_files(/.vue$|.haml$/)
return if changed_vue_haml_files.empty?
changed_lines_in_mr = get_added_lines(changed_vue_haml_files)
-has_deprecated_components = changed_lines_in_mr.select { |i| i[/#{PATTERNS.join("|")}/] }
-deprecated_components_in_mr = PATTERNS.select { |s| has_deprecated_components.join(" ")[s] }
+deprecated_components_in_mr = PATTERNS.select { |pattern| changed_lines_in_mr.any? { |line| line[pattern] } }
+blocking_components_in_mr = BLOCKING_PATTERNS.select { |pattern| changed_lines_in_mr.any? { |line| line[pattern] } }
-return if deprecated_components_in_mr.empty?
-
-warn "This merge request contains deprecated components. Please consider using Pajamas components instead."
+return if (deprecated_components_in_mr + blocking_components_in_mr).empty?
markdown(<<~MARKDOWN)
## Deprecated components
- The following components are deprecated:
+MARKDOWN
- * #{deprecated_components_in_mr.join("\n* ")}
+if blocking_components_in_mr.any?
+ markdown(<<~MARKDOWN)
+ These deprecated components have already been migrated and can no longer be used. Please use [Pajamas components](https://design.gitlab.com/components/status/) instead.
- Please consider using [Pajamas components](https://design.gitlab.com/components/status/) instead.
-MARKDOWN
+ * #{blocking_components_in_mr.join("\n* ")}
+
+ MARKDOWN
+
+ fail "This merge request contains deprecated components that have been migrated and can no longer be used. Please use Pajamas components instead."
+end
+
+if deprecated_components_in_mr.any?
+ markdown(<<~MARKDOWN)
+ These deprecated components are in the process of being migrated. Please consider using [Pajamas components](https://design.gitlab.com/components/status/) instead.
+
+ * #{deprecated_components_in_mr.join("\n* ")}
+
+ MARKDOWN
+
+ warn "This merge request contains deprecated components. Please consider using Pajamas components instead."
+end