Produces a diagnostic output in the “puppet style”, where the location is appended with an “at …” if the location is known.
# File lib/puppet/pops/validation.rb, line 302 def format diagnostic if (location = format_location diagnostic) != "" "#{format_severity(diagnostic)}#{format_message(diagnostic)}#{location}" else format_message(diagnostic) end end
The somewhat (machine) unusable format in current use by puppet. have to be used here for backwards compatibility.
# File lib/puppet/pops/validation.rb, line 312 def format_location diagnostic file = diagnostic.file file = (file.is_a?(String) && file.empty?) ? nil : file line = pos = nil if diagnostic.source_pos line = diagnostic.source_pos.line pos = diagnostic.source_pos.pos end if file && line && pos " at #{file}:#{line}:#{pos}" elsif file and line " at #{file}:#{line}" elsif line && pos " at line #{line}:#{pos}" elsif line " at line #{line}" elsif file " in #{file}" else "" end end