( path )
| 19 | return changedFiles |
| 20 | |
| 21 | def fixFile( path ): |
| 22 | f = open( path, 'r' ) |
| 23 | lines = [] |
| 24 | changed = 0 |
| 25 | for line in f: |
| 26 | trimmed = line.rstrip() + "\n" |
| 27 | trimmed = trimmed.replace('\t', ' ') |
| 28 | if trimmed != line: |
| 29 | changed = changed +1 |
| 30 | lines.append( trimmed ) |
| 31 | f.close() |
| 32 | if changed > 0: |
| 33 | global changedFiles |
| 34 | changedFiles = changedFiles + 1 |
| 35 | print( path + ":" ) |
| 36 | print( " - fixed " + str(changed) + " line(s)" ) |
| 37 | altPath = path + ".backup" |
| 38 | os.rename( path, altPath ) |
| 39 | f2 = open( path, 'w' ) |
| 40 | for line in lines: |
| 41 | f2.write( line ) |
| 42 | f2.close() |
| 43 | os.remove( altPath ) |
| 44 | return True |
| 45 | return False |
| 46 | |
| 47 | changedFiles = fixAllFilesInDir(catchPath) |
| 48 | if changedFiles > 0: |
no test coverage detected