Skip to content

Commit 92319a6

Browse files
committed
pars rflint
1 parent b53b846 commit 92319a6

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Dangerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,28 @@ else
146146
print_errors_summary 'sortpom plugin', errors_count, 'https://github.com/php-coder/mystamps/wiki/sortpom'
147147
end
148148

149+
# Handle `rflint` output
150+
rflint_output = 'rflint.log'
151+
unless File.file?(rflint_output)
152+
warn("Couldn't find #{rflint_output}. Result of rflint is unknown")
153+
else
154+
errors_count = 0
155+
current_file = ''
156+
File.readlines(rflint_output).each do |line|
157+
if line.start_with? '+ '
158+
current_file = line.sub(/^\+ /, '')
159+
next
160+
end
161+
162+
parsed = line.match(/[A-Z]: (?<line>\d+), [^:]+: (?<msg>.*)/)
163+
msg = parsed['msg'].sub(/ \(\w+\)$/, '')
164+
lineno = parsed['line']
165+
file = github.html_link("#{current_file}#{lineno}")
166+
fail("rflint error in #{file}: #{msg}")
167+
end
168+
print_errors_summary 'rflint', errors_count, 'https://github.com/php-coder/mystamps/wiki/rflint'
169+
end
170+
149171
# Handle `mvn findbugs:check` results
150172
findbugs_report = 'target/findbugsXml.xml'
151173
unless File.file?(findbugs_report)

0 commit comments

Comments
 (0)