Escape tab, newline, CR and backslash in report paths (closes #7)
check / check (push) Successful in 1m29s
check / check (push) Successful in 1m29s
A path holding a tab or newline split a row of the report or trees output. The path columns of both now write a backslash, tab, newline and carriage return as \\, \t, \n and \r; every other byte is written unchanged. Grouping and sorting still use the stored path. Warnings on stderr are escaped the same way in warnf, so each stays one line. In trees, the root directory's node now has the path "/" instead of an empty string, and its children's paths start with a single slash. README states the rule under "Report output format". Model: opus-5-5
This commit was merged in pull request #70.
This commit is contained in:
+3
-1
@@ -106,6 +106,8 @@ func (p *progress) increment() {
|
||||
}
|
||||
|
||||
// warnf prints a one-line warning to stderr without corrupting the bar.
|
||||
// The whole message is escaped like a report's path columns, so a path
|
||||
// holding a newline cannot split the warning.
|
||||
func (p *progress) warnf(format string, args ...any) {
|
||||
if p == nil {
|
||||
return
|
||||
@@ -115,7 +117,7 @@ func (p *progress) warnf(format string, args ...any) {
|
||||
_ = p.bar.Clear()
|
||||
}
|
||||
|
||||
fmt.Fprintf(os.Stderr, format+"\n", args...)
|
||||
fmt.Fprintln(os.Stderr, escapePath(fmt.Sprintf(format, args...)))
|
||||
}
|
||||
|
||||
// finish terminates the pass's display.
|
||||
|
||||
Reference in New Issue
Block a user