summaryrefslogtreecommitdiff
path: root/danger/gemfile
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/gemfile
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/gemfile')
-rw-r--r--danger/gemfile/Dangerfile19
1 files changed, 16 insertions, 3 deletions
diff --git a/danger/gemfile/Dangerfile b/danger/gemfile/Dangerfile
index dfe64f79d7b..07c4c07cfe8 100644
--- a/danger/gemfile/Dangerfile
+++ b/danger/gemfile/Dangerfile
@@ -1,5 +1,9 @@
-GEMFILE_LOCK_NOT_UPDATED_MESSAGE = <<~MSG.freeze
-**%<gemfile>s was updated but %<gemfile_lock>s wasn't updated.**
+GEMFILE_LOCK_NOT_UPDATED_MESSAGE_SHORT = <<~MSG.freeze
+%<gemfile>s was updated but %<gemfile_lock>s wasn't updated.
+MSG
+
+GEMFILE_LOCK_NOT_UPDATED_MESSAGE_FULL = <<~MSG.freeze
+**#{GEMFILE_LOCK_NOT_UPDATED_MESSAGE_SHORT}**
Usually, when %<gemfile>s is updated, you should run
```
@@ -19,5 +23,14 @@ gemfile_modified = git.modified_files.include?("Gemfile")
gemfile_lock_modified = git.modified_files.include?("Gemfile.lock")
if gemfile_modified && !gemfile_lock_modified
- warn format(GEMFILE_LOCK_NOT_UPDATED_MESSAGE, gemfile: gitlab.html_link("Gemfile"), gemfile_lock: gitlab.html_link("Gemfile.lock"))
+ gitlab_danger = GitlabDanger.new(helper.gitlab_helper)
+
+ format_str = gitlab_danger.ci? ? GEMFILE_LOCK_NOT_UPDATED_MESSAGE_FULL : GEMFILE_LOCK_NOT_UPDATED_MESSAGE_SHORT
+
+ message = format(format_str,
+ gemfile: gitlab_danger.html_link("Gemfile"),
+ gemfile_lock: gitlab_danger.html_link("Gemfile.lock")
+ )
+
+ warn(message)
end