forked from phoedos/pmd
improve danger message
This commit is contained in:
parent
d4cc311486
commit
b3a78c4ac6
25
Dangerfile
25
Dangerfile
@ -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.")
|
||||
|
Loading…
x
Reference in New Issue
Block a user