summaryrefslogtreecommitdiff
path: root/danger/duplicate_yarn_dependencies
diff options
context:
space:
mode:
authorAsh McKenzie <amckenzie@gitlab.com>2019-08-26 17:06:15 +1000
committerAsh McKenzie <amckenzie@gitlab.com>2019-09-06 10:56:54 +1000
commit70e1a17604a45419b079ab9da5ef69e010b103c6 (patch)
tree9da29bbf906f1cc8ac15eaa59372de0d5c47d58b /danger/duplicate_yarn_dependencies
parentfdc17ebc039e53dd0ed8119c92fac5fd2f43c7fe (diff)
downloadgitlab-ce-70e1a17604a45419b079ab9da5ef69e010b103c6.tar.gz
Update some Danger rules to not rely upon CI66596-allow-danger-to-be-run-locally
Convert a bunch of Danger rules so they can run locally.
Diffstat (limited to 'danger/duplicate_yarn_dependencies')
-rw-r--r--danger/duplicate_yarn_dependencies/Dangerfile24
1 files changed, 13 insertions, 11 deletions
diff --git a/danger/duplicate_yarn_dependencies/Dangerfile b/danger/duplicate_yarn_dependencies/Dangerfile
index 25f81ec86a4..492b888d00e 100644
--- a/danger/duplicate_yarn_dependencies/Dangerfile
+++ b/danger/duplicate_yarn_dependencies/Dangerfile
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-return unless helper.all_changed_files.include? 'yarn.lock'
+return unless helper.all_changed_files.include?('yarn.lock')
duplicate = `node_modules/.bin/yarn-deduplicate --list --strategy fewer yarn.lock`
.split(/$/)
@@ -11,17 +11,19 @@ return if duplicate.empty?
warn 'This merge request has introduced duplicated yarn dependencies.'
-markdown(<<~MARKDOWN)
- ## Duplicate yarn dependencies
+if GitlabDanger.new(helper.gitlab_helper).ci?
+ markdown(<<~MARKDOWN)
+ ## Duplicate yarn dependencies
- The following dependencies should be de-duplicated:
+ The following dependencies should be de-duplicated:
- * #{duplicate.map { |path| "`#{path}`" }.join("\n* ")}
+ * #{duplicate.map { |path| "`#{path}`" }.join("\n* ")}
- Please run the following command and commit the changes to `yarn.lock`:
+ Please run the following command and commit the changes to `yarn.lock`:
- ```
- node_modules/.bin/yarn-deduplicate --strategy fewer yarn.lock \\
- && yarn install
- ```
-MARKDOWN
+ ```
+ node_modules/.bin/yarn-deduplicate --strategy fewer yarn.lock \\
+ && yarn install
+ ```
+ MARKDOWN
+end