2020-02-14 14:17:16 +01:00

21 lines
532 B
Tcl
Executable File

#!/usr/bin/tclsh
# No trailing whitespace
set strictMode [getParameter "strict-trailing-space" 0]
foreach f [getSourceFileNames] {
set lineNumber 1
set previousIndent ""
foreach line [getAllLines $f] {
if [regexp {^.*[[:space:]]+$} $line] {
if {$strictMode || [string trim $line] != "" || $line != $previousIndent} {
report $f $lineNumber "trailing whitespace"
}
}
regexp {^([[:space:]]*).*$} $line dummy previousIndent
incr lineNumber
}
}