(self, filename)
| 33 | self.output.write("file %s contains %d tab characters!\n" % (filename, tabCount)) |
| 34 | |
| 35 | def checkFileForTrailingSpaces(self, filename): |
| 36 | txt = open_and_read(filename, 'r') |
| 37 | initSize = len(txt) |
| 38 | badLines = 0 |
| 39 | badChars = 0 |
| 40 | for line in string.split(txt, '\n'): |
| 41 | stripped = string.rstrip(line) |
| 42 | spaces = len(line) - len(stripped) # OK, so they might be trailing tabs, who cares? |
| 43 | if spaces: |
| 44 | badLines = badLines + 1 |
| 45 | badChars = badChars + spaces |
| 46 | |
| 47 | if badChars <> 0: |
| 48 | self.output.write("file %s contains %d trailing spaces, or %0.2f%% wastage\n" % (filename, badChars, 100.0*badChars/initSize)) |
| 49 | |
| 50 | def testFiles(self): |
| 51 | w = GlobDirectoryWalker(RL_HOME, '*.py') |
no test coverage detected