As a commonly accepted practice, line breaks are denoted by a single '\n' (LF) character or by two characters "\r\n" (CRLF). A single appearance of '\r' (CR) is discouraged.
Hide source code
# Source files should not use the '\r' (CR) character
foreach fileName [getSourceFileNames] {
set file [open $fileName "r"]
fconfigure $file -translation lf
set line [gets $file]
set lineCounter 1
while {![eof $file]} {
set pos [string first "\r" $line]
if {$pos != -1 && $pos != [expr [string length $line] - 1]} {
report $fileName $lineCounter "\\r (CR) detected in isolation at position ${pos}"
}
set line [gets $file]
incr lineCounter
}
close $file
}