Skip to content

Commit 1094952

Browse files
committed
Dangerfile: don't warn about missing reports because now they're optional.
Related to #423
1 parent 70bfbb2 commit 1094952

File tree

1 file changed

+15
-45
lines changed

1 file changed

+15
-45
lines changed

Dangerfile

+15-45
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ end
3434
# </file>
3535
#
3636
cs_report = 'target/checkstyle-result.xml'
37-
unless File.file?(cs_report)
38-
warn("Couldn't find #{cs_report}. maven-checkstyle-plugin result is unknown")
39-
else
37+
if File.file?(cs_report)
4038
errors_count = 0
4139
doc = Nokogiri::XML(File.open(cs_report))
4240
doc.xpath('//error').each do |node|
@@ -60,9 +58,7 @@ end
6058
# </file>
6159
#
6260
pmd_report = 'target/pmd.xml'
63-
unless File.file?(pmd_report)
64-
warn("Couldn't find #{pmd_report}. maven-pmd-plugin result is unknown")
65-
else
61+
if File.file?(pmd_report)
6662
errors_count = 0
6763
doc = Nokogiri::XML(File.open(pmd_report))
6864
doc.xpath('//violation').each do |node|
@@ -99,9 +95,7 @@ end
9995
# </CodeNarc>
10096
#
10197
codenarc_report = 'target/CodeNarc.xml'
102-
unless File.file?(codenarc_report)
103-
warn("Couldn't find #{codenarc_report}. codenarc-maven-plugin result is unknown")
104-
else
98+
if File.file?(codenarc_report)
10599
errors_count = 0
106100
doc = Nokogiri::XML(File.open(codenarc_report))
107101
root_dir = doc.xpath('//SourceDirectory').first.text.sub(pwd, '')
@@ -128,9 +122,7 @@ end
128122
# [INFO] ------------------------------------------------------------------------
129123
#
130124
license_output = 'license.log'
131-
unless File.file?(license_output)
132-
warn("Couldn't find #{license_output}. license-maven-plugin result is unknown")
133-
else
125+
if File.file?(license_output)
134126
errors = []
135127
File.readlines(license_output)
136128
.select { |line| line.start_with? '[WARNING]' }
@@ -177,9 +169,7 @@ end
177169
# [INFO] ------------------------------------------------------------------------
178170
#
179171
sortpom_output = 'pom.log'
180-
unless File.file?(sortpom_output)
181-
warn("Couldn't find #{sortpom_output}. sortpom-maven-plugin result is unknown")
182-
else
172+
if File.file?(sortpom_output)
183173
errors = []
184174
File.readlines(sortpom_output).each do |line|
185175
# don't process lines after this message
@@ -225,9 +215,7 @@ end
225215
# 3 lint error(s) found across 20 file(s).
226216
#
227217
bootlint_output = 'bootlint.log'
228-
unless File.file?(bootlint_output)
229-
warn("Couldn't find #{bootlint_output}. Result of bootlint is unknown")
230-
else
218+
if File.file?(bootlint_output)
231219
errors_count = 0
232220
File.readlines(bootlint_output).each do |line|
233221
if line !~ /:\d+:\d+/
@@ -255,9 +243,7 @@ end
255243
# E: 35, 0: Too many steps (34) in test case (TooManyTestSteps)
256244
#
257245
rflint_output = 'rflint.log'
258-
unless File.file?(rflint_output)
259-
warn("Couldn't find #{rflint_output}. Result of rflint is unknown")
260-
else
246+
if File.file?(rflint_output)
261247
errors_count = 0
262248
current_file = ''
263249
File.readlines(rflint_output).each do |line|
@@ -289,9 +275,7 @@ end
289275
# [INFO] ------------------------------------------------------------------------
290276
#
291277
enforcer_output = 'enforcer.log'
292-
unless File.file?(enforcer_output)
293-
warn("Couldn't find #{enforcer_output}. maven-enforcer-plugin result is unknown")
294-
else
278+
if File.file?(enforcer_output)
295279
errors = []
296280
plugin_output_started = false
297281
File.readlines(enforcer_output).each do |line|
@@ -339,9 +323,7 @@ end
339323
# </testsuite>
340324
#
341325
jasmine_report = 'target/jasmine/TEST-jasmine.xml'
342-
unless File.file?(jasmine_report)
343-
warn("Couldn't find #{jasmine_report}. jasmine-maven-plugin results is unknown")
344-
else
326+
if File.file?(jasmine_report)
345327
doc = Nokogiri::XML(File.open(jasmine_report))
346328
testsuite = doc.xpath('/testsuite').first
347329
failures = testsuite['failures'].to_i
@@ -364,9 +346,7 @@ end
364346
# "file:/home/coder/mystamps/src/main/webapp/WEB-INF/views/series/info.html":438.16-438.35: error: very long err msg.
365347
#
366348
validator_output = 'validator.log'
367-
unless File.file?(validator_output)
368-
warn("Couldn't find #{validator_output}. html5validator result is unknown")
369-
else
349+
if File.file?(validator_output)
370350
errors_count = 0
371351
File.readlines(validator_output).each do |line|
372352
errors_count += 1
@@ -431,9 +411,7 @@ end
431411
# Also because goals are executing in order and the process stops if one of
432412
# them failed, we're using the same array to collect errors from different goals.
433413
test_output = 'test.log'
434-
unless File.file?(test_output)
435-
warn("Couldn't find #{test_output}. Result of running unit tests is unknown")
436-
else
414+
if File.file?(test_output)
437415
errors = []
438416
plugin_output_started = false
439417
errors_detected = false
@@ -521,9 +499,7 @@ end
521499
#
522500
test_reports_pattern = 'target/surefire-reports/TEST-*.xml'
523501
test_reports = Dir.glob(test_reports_pattern)
524-
if test_reports.empty?
525-
warn("Couldn't find #{test_reports_pattern}. maven-surefire-plugin results is unknown")
526-
else
502+
unless test_reports.empty?
527503
errors_count = 0
528504
test_reports.each do |file|
529505
doc = Nokogiri::XML(File.open(file))
@@ -568,9 +544,7 @@ end
568544
# </BugCollection>
569545
#
570546
findbugs_report = 'target/findbugsXml.xml'
571-
unless File.file?(findbugs_report)
572-
warn("Couldn't find #{findbugs_report}. findbugs-maven-plugin result is unknown")
573-
else
547+
if File.file?(findbugs_report)
574548
errors_count = 0
575549
doc = Nokogiri::XML(File.open(findbugs_report))
576550
src_dirs = doc.xpath('//SrcDir').map { |node| node.text }
@@ -604,9 +578,7 @@ end
604578
# </test>
605579
# </suite>
606580
rf_report = 'target/robotframework-reports/output.xml'
607-
unless File.file?(rf_report)
608-
warn("Couldn't find #{rf_report}. robotframework-maven-plugin result is unknown")
609-
else
581+
if File.file?(rf_report)
610582
errors_count = 0
611583
doc = Nokogiri::XML(File.open(rf_report))
612584
doc.xpath('//status[@critical="yes"][@status="FAIL"]').each do |node|
@@ -646,9 +618,7 @@ end
646618
# ...
647619
#
648620
failsafe_report = 'target/failsafe-reports/testng-results.xml'
649-
unless File.file?(failsafe_report)
650-
warn("Couldn't find #{failsafe_report}. maven-failsafe-plugin result is unknown")
651-
else
621+
if File.file?(failsafe_report)
652622
errors_count = 0
653623
doc = Nokogiri::XML(File.open(failsafe_report))
654624
results = doc.xpath('/testng-results').first

0 commit comments

Comments
 (0)