Permalink
Browse files

can pass a list of files to lint.py

  • Loading branch information...
1 parent 7db66f2 commit 814807af7fb3c28716b2da9518cdca9608c84f86 @erh erh committed Oct 16, 2012
Showing with 13 additions and 6 deletions.
  1. +1 −1 SConstruct
  2. +11 −5 buildscripts/lint.py
  3. +1 −0 buildscripts/utils.py
View
@@ -920,7 +920,7 @@ env.AlwaysBuild( "style" )
def doLint( env , target , source ):
import buildscripts.lint
- if not buildscripts.lint.run_lint():
+ if not buildscripts.lint.run_lint( [ "src/mongo/" ] ):
raise Exception( "lint errors" )
env.Alias( "lint" , [] , [ doLint ] )
View
@@ -6,7 +6,7 @@
import utils
-def run_lint( prefix="src/mongo", nudgeOn=False ):
+def run_lint( paths, nudgeOn=False ):
# errors are as of 10/14
# idea is not to let it any new type of error
# as we knock one out, we should remove line
@@ -53,9 +53,12 @@ def run_lint( prefix="src/mongo", nudgeOn=False ):
if not nudgeOn:
filters = filters + nudge
+
+ sourceFiles = []
+ for x in paths:
+ utils.getAllSourceFiles( sourceFiles, x )
- sourceFiles = utils.getAllSourceFiles( prefix=prefix )
args = [ "--filter=" + ",".join( filters ) , "--counting=detailed" ] + sourceFiles
filenames = cpplint.ParseArguments( args )
@@ -84,7 +87,7 @@ def _ourIsTestFilename(fn):
if __name__ == "__main__":
- prefix = "src/mongo"
+ paths = []
nudge = False
for arg in sys.argv[1:]:
@@ -95,7 +98,10 @@ def _ourIsTestFilename(fn):
else:
print( "unknown arg [%s]" % arg )
sys.exit(-1)
- prefix = arg
+ paths.append( arg )
- if not run_lint( prefix, nudge ):
+ if len(paths) == 0:
+ paths.append( "src/mongo/" )
+
+ if not run_lint( paths, nudge ):
sys.exit(-1)
@@ -29,6 +29,7 @@ def getAllSourceFiles( arr=None , prefix="." ):
getAllSourceFiles( arr , full )
else:
if full.endswith( ".cpp" ) or full.endswith( ".h" ) or full.endswith( ".c" ):
+ full = full.replace( "//" , "/" )
arr.append( full )
return arr

0 comments on commit 814807a

Please sign in to comment.