Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
55 lines (48 sloc) 1.17 KB
import io/FileReader
import os/Process
import structs/ArrayList
import text/StringTokenizer
main: func(args: ArrayList<String>) {
progname := args removeAt(0)
if (args getSize() == 0)
args = Process new(["git", "ls-files"]) getOutput() split("\n")
"1..1" println()
res := true
for (fname in args)
if (filter(fname))
res &= check(fname)
if (res)
("ok 1 - " + progname) println()
else
("not ok 1 - " + progname) println()
}
filter: func(fname: String) -> Bool {
if (fname == "")
return false
if (fname endsWith?("Makefile"))
return false
if (fname endsWith?(".a"))
return false
if (fname endsWith?(".c"))
return false
if (fname endsWith?(".h"))
return false
return true
}
check: func(fname: String) -> Bool {
file := FileReader new(fname, "rt")
res := true
i := 1
file eachLine(
func(line: String) -> Bool {
if (line contains?("\t")) {
"# %s:%d" format(fname, i) println()
res = false
}
i += 1
return true
}
)
file close()
return res
}