From b93ee25b64de5d587c2e0889a9ce689c92aaa0f9 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Sun, 23 Feb 2014 20:41:07 -0500 Subject: [PATCH] make bash8 take a -v flag this ensures that we actually know we are processing all the files we believe we are. Change-Id: I8e99b5f9dc987c946586475f374f7040ca63a478 --- run_tests.sh | 2 +- tools/bash8.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index b4f26c5709..a0bfbee0c0 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -26,4 +26,4 @@ fi echo "Running bash8..." -./tools/bash8.py $FILES +./tools/bash8.py -v $FILES diff --git a/tools/bash8.py b/tools/bash8.py index 7552e0d642..ca0abd964a 100755 --- a/tools/bash8.py +++ b/tools/bash8.py @@ -110,11 +110,13 @@ def end_of_multiline(line, token): return False -def check_files(files): +def check_files(files, verbose): in_multiline = False logical_line = "" token = False for line in fileinput.input(files): + if verbose and fileinput.isfirstline(): + print "Running bash8 on %s" % fileinput.filename() # NOTE(sdague): multiline processing of heredocs is interesting if not in_multiline: logical_line = line @@ -141,13 +143,14 @@ def get_options(): parser.add_argument('files', metavar='file', nargs='+', help='files to scan for errors') parser.add_argument('-i', '--ignore', help='Rules to ignore') + parser.add_argument('-v', '--verbose', action='store_true', default=False) return parser.parse_args() def main(): opts = get_options() register_ignores(opts.ignore) - check_files(opts.files) + check_files(opts.files, opts.verbose) if ERRORS > 0: print("%d bash8 error(s) found" % ERRORS)