improve danger message

This commit is contained in:
BBG 2018-09-10 21:16:42 +08:00
parent d4cc311486
commit b3a78c4ac6
2 changed files with 11 additions and 16 deletions

View File

@ -7,20 +7,14 @@ require 'logger'
def run_pmdtester
Dir.chdir('..') do
argv = ['-r', './pmd', '-b', "#{ENV['TRAVIS_BRANCH']}", '-p', 'FETCH_HEAD', '-m', 'online', '-a']
Process.fork do
begin
runner = PmdTester::Runner.new(argv)
introduce_new_pmd_errors = runner.run
warn("The PR may introduce new PMD errors!") if introduce_new_pmd_errors
rescue StandardError => e
warn("Running pmdtester failed, this message is mainly used to remind the maintainers of PMD.")
@logger.error "Running pmdtester failed: #{e.inspect}"
exit 1
end
end
Process.wait
upload_report if $?.success?
begin
runner = PmdTester::Runner.new(argv)
@new_errors, @removed_errors, @new_violations, @removed_violations = runner.run
upload_report
rescue StandardError => e
warn("Running pmdtester failed, this message is mainly used to remind the maintainers of PMD.")
@logger.error "Running pmdtester failed: #{e.inspect}"
end
end
end
@ -38,7 +32,8 @@ def upload_report
@logger.info "Successfully uploaded #{tar_filename} to chunk.io"
# set value of sticky to true and the message is kept after new commits are submited to the PR
message("Please check the [regression diff report](#{report_url.chomp}/diff/index.html) to make sure that everything is expected", sticky: true)
message("This changeset introduce #{@new_violations} new violations and #{@new_errors} new errors,\n" +
"removes #{@removed_violations} violations and #{@removed_errors} errors. [Full report](#{report_url.chomp}/diff/index.html)", sticky: true)
else
@logger.error "Error while uploading #{tar_filename} to chunk.io: #{report_url}"
warn("Uploading the diff report failed, this message is mainly used to remind the maintainers of PMD.")

View File

@ -1,6 +1,6 @@
source 'https://rubygems.org/'
gem 'pmdtester', '~> 1.0.0.pre.beta3'
gem 'pmdtester', :git => 'https://github.com/pmd/pmd-regression-tester.git'
gem 'danger', '~> 5.6', '>= 5.6'
# This group is only needed for rendering release notes