File: F001.tcl

package info (click to toggle)
vera%2B%2B 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 1,184 kB
  • sloc: cpp: 10,361; tcl: 921; python: 32; makefile: 5
file content (22 lines) | stat: -rwxr-xr-x 647 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/tclsh
# Source files should not use the '\r' (CR) character

foreach fileName [getSourceFileNames] {
    if { $fileName == "-" } {
      # can't check the content from stdin
      continue
    }
    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
}