3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/scss_lint_reporter_checkstyle.rb', line 3
def report_lints
output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
output << "<checkstyle version=\"1.5.6\">\n"
lints.group_by(&:filename).each do |file_name, errors|
file_name_absolute = File.expand_path file_name
output << " <file name=#{file_name_absolute.encode(xml: :attr)}>\n"
errors.each do |error|
output << " <error source=\"#{error.linter.name if error.linter}\" " \
"line=\"#{error.location.line}\" " \
"column=\"#{error.location.column}\" " \
"length=\"#{error.location.length}\" " \
"severity=\"#{error.severity}\" " \
"message=#{error.description.encode(xml: :attr)} />\n"
end
output << " </file>\n"
end
output << "</checkstyle>\n"
output
end
|