From 9fc9ab2ba2b0db05f6365054aa3bddcda3c7333d Mon Sep 17 00:00:00 2001 From: Ash McKenzie Date: Fri, 6 Sep 2019 11:21:53 +0000 Subject: Add new GitlabDanger class This class encapsulates our use of the Danger gem. --- danger/frozen_string/Dangerfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'danger/frozen_string') diff --git a/danger/frozen_string/Dangerfile b/danger/frozen_string/Dangerfile index b9687ef6b83..8d3ac3dee68 100644 --- a/danger/frozen_string/Dangerfile +++ b/danger/frozen_string/Dangerfile @@ -16,11 +16,13 @@ if files_to_fix.any? warn 'This merge request adds files that do not enforce frozen string literal. ' \ 'See https://gitlab.com/gitlab-org/gitlab-ce/issues/47424 for more information.' - markdown(<<~MARKDOWN) - ## Enable Frozen String Literal + if GitlabDanger.new(helper.gitlab_helper).ci? + markdown(<<~MARKDOWN) + ## Enable Frozen String Literal - The following files should have `#{MAGIC_COMMENT}` on the first line: + The following files should have `#{MAGIC_COMMENT}` on the first line: - * #{files_to_fix.map { |path| "`#{path}`" }.join("\n* ")} - MARKDOWN + * #{files_to_fix.map { |path| "`#{path}`" }.join("\n* ")} + MARKDOWN + end end -- cgit v1.2.3