Show More
|
1 | NO CONTENT: modified file |
|
1 | NO CONTENT: modified file |
|
1 | NO CONTENT: modified file chmod 100755 => 100644, modified file |
|
1 | NO CONTENT: modified file |
|
1 | NO CONTENT: modified file |
|
1 | NO CONTENT: modified file |
@@ -1,32 +1,54 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | """Utility to look for hard tabs and \r characters in all sources. |
|
3 | ||
|
4 | Usage: | |
|
5 | ||
|
6 | ./check_sources.py | |
|
7 | ||
|
8 | It prints summaries and if chosen, line-by-line info of where \\t or \\r | |
|
9 | characters can be found in our source tree. | |
|
3 | 10 | """ |
|
4 | 11 | |
|
5 | from IPython.external.path import path | |
|
12 | # Config | |
|
13 | # If true, all lines that have tabs are printed, with line number | |
|
14 | full_report_tabs = True | |
|
15 | # If true, all lines that have tabs are printed, with line number | |
|
16 | full_report_rets = False | |
|
6 | 17 | |
|
7 | fs = path('..').walkfiles('*.py') | |
|
18 | # Code begins | |
|
19 | from IPython.external.path import path | |
|
8 | 20 | |
|
9 | 21 | rets = [] |
|
22 | tabs = [] | |
|
10 | 23 | |
|
11 | for f in fs: | |
|
24 | for f in path('..').walkfiles('*.py'): | |
|
12 | 25 | errs = '' |
|
13 | 26 | cont = f.bytes() |
|
14 | 27 | if '\t' in cont: |
|
15 | 28 | errs+='t' |
|
29 | tabs.append(f) | |
|
16 | 30 | |
|
17 | 31 | if '\r' in cont: |
|
18 | 32 | errs+='r' |
|
19 | 33 | rets.append(f) |
|
20 | 34 | |
|
21 | 35 | if errs: |
|
22 | 36 | print "%3s" % errs, f |
|
23 | if 't' in errs: | |
|
37 | ||
|
38 | if 't' in errs and full_report_tabs: | |
|
24 | 39 |
|
|
25 | 40 |
|
|
26 | 41 |
|
|
27 | if 'r' in errs: | |
|
42 | ||
|
43 | if 'r' in errs and full_report_rets: | |
|
28 | 44 |
|
|
29 | 45 |
|
|
30 | 46 |
|
|
31 | 47 | |
|
32 | rr = rets[-1] | |
|
48 | # Summary at the end, to call cleanup tools if necessary | |
|
49 | if tabs: | |
|
50 | print 'Hard tabs found. These can be cleaned with untabify:' | |
|
51 | for f in tabs: print f, | |
|
52 | if rets: | |
|
53 | print 'Carriage returns (\\r) found in:' | |
|
54 | for f in rets: print f, |
General Comments 0
You need to be logged in to leave comments.
Login now