summaryrefslogtreecommitdiff
path: root/lib/tasks/gitlab_danger.rake
blob: 5df4a8ce4f11f687a5409712256c27b431e2c633 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

desc 'Run local Danger rules'
task :danger_local do
  require_relative '../../tooling/gitlab_danger'
  require '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