33# Runs pylint on all python scripts found in a directory tree
44# Reference: http://rowinggolfer.blogspot.com/2009/08/pylint-recursively.html
55
6+ from __future__ import print_function
7+
68import os
79import re
810import sys
@@ -17,26 +19,26 @@ def check(module):
1719
1820 if module [- 3 :] == ".py" :
1921
20- print "CHECKING " , module
22+ print ( "CHECKING " , module )
2123 pout = os .popen ("pylint --rcfile=/dev/null %s" % module , 'r' )
2224 for line in pout :
2325 if re .match (r"\AE:" , line ):
24- print line .strip ()
26+ print ( line .strip () )
2527 if __RATING__ and "Your code has been rated at" in line :
26- print line
28+ print ( line )
2729 score = re .findall (r"\d.\d\d" , line )[0 ]
2830 total += float (score )
2931 count += 1
3032
3133if __name__ == "__main__" :
3234 try :
33- print sys .argv
35+ print ( sys .argv )
3436 BASE_DIRECTORY = sys .argv [1 ]
3537 except IndexError :
36- print "no directory specified, defaulting to current working directory"
38+ print ( "no directory specified, defaulting to current working directory" )
3739 BASE_DIRECTORY = os .getcwd ()
3840
39- print "looking for *.py scripts in subdirectories of " , BASE_DIRECTORY
41+ print ( "looking for *.py scripts in subdirectories of " , BASE_DIRECTORY )
4042 for root , dirs , files in os .walk (BASE_DIRECTORY ):
4143 if any (_ in root for _ in ("extra" , "thirdparty" )):
4244 continue
@@ -45,6 +47,6 @@ def check(module):
4547 check (filepath )
4648
4749 if __RATING__ :
48- print "==" * 50
49- print "%d modules found" % count
50- print "AVERAGE SCORE = %.02f" % (total / count )
50+ print ( "==" * 50 )
51+ print ( "%d modules found" % count )
52+ print ( "AVERAGE SCORE = %.02f" % (total / count ) )
0 commit comments