|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /usr/share/doc/subversion-1.6.11/tools/dev/ |
Upload File : |
#!/usr/bin/python
#
# Find places in our code where whitespace is erroneously used before
# the open-paren on a function all. This is typically manifested like:
#
# return svn_some_function
# (param1, param2, param3)
#
#
# USAGE: find-bad-style.py FILE1 FILE2 ...
#
import sys
import re
re_call = re.compile(r'^\s*\(')
re_func = re.compile(r'.*[a-z0-9_]{1,}\s*$')
def scan_file(fname):
lines = open(fname).readlines()
prev = None
line_num = 1
for line in lines:
if re_call.match(line):
if prev and re_func.match(prev):
print('%s:%d:%s' % (fname, line_num - 1, prev.rstrip()))
prev = line
line_num += 1
if __name__ == '__main__':
for fname in sys.argv[1:]:
scan_file(fname)