Skip to content

Commit ad2ec67

Browse files
committed
Dangerfile: handle rflint output.
1 parent 47c00ca commit ad2ec67

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Dangerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,35 @@ else
205205
end
206206
end
207207

208+
# Handle `rflint` output
209+
#
210+
# Example:
211+
# + src/test/robotframework/series/creation/logic.robot
212+
# E: 35, 0: Too many steps (34) in test case (TooManyTestSteps)
213+
#
214+
rflint_output = 'rflint.log'
215+
unless File.file?(rflint_output)
216+
warn("Couldn't find #{rflint_output}. Result of rflint is unknown")
217+
else
218+
errors_count = 0
219+
current_file = ''
220+
File.readlines(rflint_output).each do |line|
221+
if line.start_with? '+ '
222+
current_file = line.sub(/^\+ /, '').rstrip
223+
next
224+
end
225+
226+
errors_count += 1
227+
228+
parsed = line.match(/[A-Z]: (?<line>\d+), [^:]+: (?<msg>.*)/)
229+
msg = parsed['msg'].sub(/ \(\w+\)$/, '')
230+
lineno = parsed['line']
231+
file = github.html_link("#{current_file}#L#{lineno}")
232+
fail("rflint error in #{file}:\n#{msg}")
233+
end
234+
print_errors_summary 'rflint', errors_count, 'https://github.com/php-coder/mystamps/wiki/rflint'
235+
end
236+
208237
# Handle `mvn findbugs:check` results
209238
#
210239
# Example:

0 commit comments

Comments
 (0)