From ecd60e8e3e65e62b788fc9d63c5a675670ef67e6 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sun, 20 Jan 2019 20:17:23 +0100 Subject: [PATCH] Danger: Update PmdTester execution to report also configuration errors Refs pmd/pmd-regression-tester#57 --- Dangerfile | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Dangerfile b/Dangerfile index daba7c415c..aaa19c33bc 100644 --- a/Dangerfile +++ b/Dangerfile @@ -9,7 +9,7 @@ def run_pmdtester argv = ['-r', './pmd', '-b', "#{ENV['TRAVIS_BRANCH']}", '-p', 'FETCH_HEAD', '-m', 'online', '-a'] begin runner = PmdTester::Runner.new(argv) - @new_errors, @removed_errors, @new_violations, @removed_violations = runner.run + @new_errors, @removed_errors, @new_violations, @removed_violations, @new_configerrors, @removed_configerrors = runner.run upload_report rescue StandardError => e warn("Running pmdtester failed, this message is mainly used to remind the maintainers of PMD.") @@ -27,14 +27,17 @@ def upload_report end `tar -cf #{tar_filename} diff/` - report_url = `curl -u #{ENV['CHUNK_TOKEN']} -T #{tar_filename} chunk.io` - if $?.success? - @logger.info "Successfully uploaded #{tar_filename} to chunk.io" + report_url = `curl -u #{ENV['CHUNK_TOKEN']} -T #{tar_filename} chunk.io` + if $?.success? + @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("This changeset introduces #{@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 + message("This changeset introduces #{@new_violations} new violations, #{@new_errors} new errors and " + + "#{@new_configerrors} new configuration errors,\n" + + "removes #{@removed_violations} violations, #{@removed_errors} errors and " + + "#{@removed_configerrors} configuration errors.\n" + + "[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.") end