Allow running against a single file

reviewable/pr18001/r3
Matt Martz 10 years ago committed by John Barker
parent efd8787e0b
commit 0386aa2643

@ -293,7 +293,7 @@ class PythonPackageValidator(Validator):
def main(): def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('modules', help='Path to modules') parser.add_argument('modules', help='Path to module or module directory')
parser.add_argument('-w', '--warnings', help='Show warnings', parser.add_argument('-w', '--warnings', help='Show warnings',
action='store_true') action='store_true')
args = parser.parse_args() args = parser.parse_args()
@ -302,6 +302,13 @@ def main():
exit = [] exit = []
# Allow testing against a single file
if os.path.isfile(args.modules):
mv = ModuleValidator(os.path.abspath(args.modules))
mv.validate()
exit.append(mv.report(args.warnings))
sys.exit(sum(exit))
for root, dirs, files in os.walk(args.modules): for root, dirs, files in os.walk(args.modules):
basedir = root[len(args.modules)+1:].split('/', 1)[0] basedir = root[len(args.modules)+1:].split('/', 1)[0]
if basedir in BLACKLIST_DIRS: if basedir in BLACKLIST_DIRS:

Loading…
Cancel
Save