##// END OF EJS Templates
Switch master to development of 6.0...
Switch master to development of 6.0 I'm thinking about this because we've just released 5.1, but I'm happy for it to wait a bit longer if we prefer. As planned, 6.0 will require Python 3, while we will continue to support 5.x for some time for Python 2 users. Before merging this, we should send a message to the mailing list for any Python 2 users following master, and make a 5.x branch off master.

File last commit:

r20277:6ceb4492
r22795:3074aa87
Show More
check_sources.py
55 lines | 1.4 KiB | text/x-python | PythonLexer
#!/usr/bin/env python
"""Utility to look for hard tabs and \r characters in all sources.
Usage:
./check_sources.py
It prints summaries and if chosen, line-by-line info of where \\t or \\r
characters can be found in our source tree.
"""
from __future__ import print_function
# Config
# If true, all lines that have tabs are printed, with line number
full_report_tabs = True
# If true, all lines that have tabs are printed, with line number
full_report_rets = False
# Code begins
from IPython.external.path import path
rets = []
tabs = []
for f in path('..').walkfiles('*.py'):
errs = ''
cont = f.bytes()
if '\t' in cont:
errs+='t'
tabs.append(f)
if '\r' in cont:
errs+='r'
rets.append(f)
if errs:
print("%3s" % errs, f)
if 't' in errs and full_report_tabs:
for ln,line in enumerate(f.lines()):
if '\t' in line:
print('TAB:',ln,':',line, end=' ')
if 'r' in errs and full_report_rets:
for ln,line in enumerate(open(f.abspath(),'rb')):
if '\r' in line:
print('RET:',ln,':',line, end=' ')
# Summary at the end, to call cleanup tools if necessary
if tabs:
print('Hard tabs found. These can be cleaned with untabify:')
for f in tabs: print(f, end=' ')
if rets:
print('Carriage returns (\\r) found in:')
for f in rets: print(f, end=' ')