diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2019-09-06 11:23:24 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2019-09-06 11:23:24 +0300 |
commit | 6def5bd66b04f887dd0d24ae4030ec86195ff7cb (patch) | |
tree | ffa78412f4974fe0471e12bb655d3904d87cea73 /lib | |
parent | 93f16f3dcd0e6faa9988f1407c14b4b251945c0a (diff) | |
parent | f34e4545ec20953267ee187227116756562c6e8a (diff) |
Merge branch 'revert-351d72cb' into 'master'
Revert "Merge branch '66596-allow-danger-to-be-run-locally' into 'master'"
See merge request gitlab-org/gitlab-ce!32741
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/danger/helper.rb | 6 | ||||
-rw-r--r-- | lib/gitlab_danger.rb | 54 | ||||
-rw-r--r-- | lib/tasks/gitlab_danger.rake | 17 |
3 files changed, 1 insertions, 76 deletions
diff --git a/lib/gitlab/danger/helper.rb b/lib/gitlab/danger/helper.rb index 702c73e8e4d..17ad07bfc0c 100644 --- a/lib/gitlab/danger/helper.rb +++ b/lib/gitlab/danger/helper.rb @@ -38,12 +38,8 @@ module Gitlab ENV['CI_PROJECT_NAME'] == 'gitlab-ee' || File.exist?('../../CHANGELOG-EE.md') end - def gitlab_helper - gitlab if respond_to?(:gitlab) - end - def release_automation? - gitlab_helper&.mr_author == RELEASE_TOOLS_BOT + gitlab.mr_author == RELEASE_TOOLS_BOT end def project_name diff --git a/lib/gitlab_danger.rb b/lib/gitlab_danger.rb deleted file mode 100644 index b4768a9546d..00000000000 --- a/lib/gitlab_danger.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -class GitlabDanger - LOCAL_RULES ||= %w[ - changes_size - gemfile - documentation - frozen_string - duplicate_yarn_dependencies - prettier - eslint - database - ].freeze - - CI_ONLY_RULES ||= %w[ - metadata - changelog - specs - commit_messages - roulette - single_codebase - gitlab_ui_wg - ce_ee_vue_templates - only_documentation - ].freeze - - MESSAGE_PREFIX = '==>'.freeze - - attr_reader :gitlab_danger_helper - - def initialize(gitlab_danger_helper) - @gitlab_danger_helper = gitlab_danger_helper - end - - def self.local_warning_message - "#{MESSAGE_PREFIX} Only the following Danger rules can be run locally: #{LOCAL_RULES.join(', ')}" - end - - def self.success_message - "#{MESSAGE_PREFIX} No Danger rule violations!" - end - - def rule_names - ci? ? LOCAL_RULES | CI_ONLY_RULES : LOCAL_RULES - end - - def html_link(str) - self.ci? ? gitlab_danger_helper.html_link(str) : str - end - - def ci? - !gitlab_danger_helper.nil? - end -end diff --git a/lib/tasks/gitlab_danger.rake b/lib/tasks/gitlab_danger.rake deleted file mode 100644 index c2f5843a9a5..00000000000 --- a/lib/tasks/gitlab_danger.rake +++ /dev/null @@ -1,17 +0,0 @@ -desc 'Run local Danger rules' -task :danger_local do - require 'gitlab_danger' - require_relative '../../lib/gitlab/popen' - - puts("#{GitlabDanger.local_warning_message}\n") - - # _status will _always_ be 0, regardless of failure or success :( - output, _status = Gitlab::Popen.popen(%w{danger dry_run}) - - if output.empty? - puts(GitlabDanger.success_message) - else - puts(output) - exit(1) - end -end |