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
This commit is contained in:
Sean Dague 2014-02-23 20:41:07 -05:00
parent d7e38ebd05
commit b93ee25b64
2 changed files with 6 additions and 3 deletions

View File

@ -26,4 +26,4 @@ fi
echo "Running bash8..."
./tools/bash8.py $FILES
./tools/bash8.py -v $FILES

View File

@ -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)