2021-02-05 07:09:31 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-09-06 07:21:53 -04:00
|
|
|
desc 'Run local Danger rules'
|
|
|
|
task :danger_local do
|
2021-03-12 07:09:33 -05:00
|
|
|
require_relative '../../tooling/danger/project_helper'
|
2019-09-06 07:21:53 -04:00
|
|
|
require 'gitlab/popen'
|
|
|
|
|
2021-03-12 07:09:33 -05:00
|
|
|
puts("#{Tooling::Danger::ProjectHelper.local_warning_message}\n")
|
2019-09-06 07:21:53 -04:00
|
|
|
|
|
|
|
# _status will _always_ be 0, regardless of failure or success :(
|
|
|
|
output, _status = Gitlab::Popen.popen(%w{danger dry_run})
|
|
|
|
|
|
|
|
if output.empty?
|
2021-03-12 07:09:33 -05:00
|
|
|
puts(Tooling::Danger::ProjectHelper.success_message)
|
2019-09-06 07:21:53 -04:00
|
|
|
else
|
|
|
|
puts(output)
|
|
|
|
exit(1)
|
|
|
|
end
|
|
|
|
end
|