Mercurial > embed
comparison vera/rules/F001.tcl @ 57:82b832e1875d
vera: import 1.3.0, closes #728
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 21 Nov 2017 12:19:28 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
56:056ee6b5913e | 57:82b832e1875d |
---|---|
1 #!/usr/bin/tclsh | |
2 # Source files should not use the '\r' (CR) character | |
3 | |
4 foreach fileName [getSourceFileNames] { | |
5 if { $fileName == "-" } { | |
6 # can't check the content from stdin | |
7 continue | |
8 } | |
9 set file [open $fileName "r"] | |
10 fconfigure $file -translation lf | |
11 set line [gets $file] | |
12 set lineCounter 1 | |
13 while {![eof $file]} { | |
14 set pos [string first "\r" $line] | |
15 if {$pos != -1 && $pos != [expr [string length $line] - 1]} { | |
16 report $fileName $lineCounter "\\r (CR) detected in isolation at position ${pos}" | |
17 } | |
18 set line [gets $file] | |
19 incr lineCounter | |
20 } | |
21 close $file | |
22 } |