7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/idxfence/render.rb', line 7
def text(findings, warning: nil)
lines = []
lines << "idxfence: #{warning}" if warning
if findings.empty?
lines << "idxfence: no unguarded uniqueness validations found" unless warning
return lines.join("\n")
end
lines << "idxfence: #{findings.size} finding(s)"
findings.each do |f|
scope_desc = f.scope.empty? ? "" : " (scope: #{f.scope.join(', ')})"
lines << "[#{f.code}] #{f.file}:#{f.line} #{f.model}##{f.column}#{scope_desc} -> #{f.table} has no matching unique index: #{f.message}"
end
lines.join("\n")
end
|