print("Invalid line in exceptions file: %s"%exception)
continue
filename=out[0]
line=out[1]
exceptions.add((filename,line))
returnexceptions
defmain():
defmain():
rootdir=os.path.dirname(__file__)+"/../"
rootdir=os.path.dirname(__file__)+"/../"
rootdir=os.path.abspath(rootdir)
rootdir=os.path.abspath(rootdir)
exceptions=load_exceptions(rootdir)
iflen(args.filenames)>0:
iflen(args.filenames)>0:
files=args.filenames
files=args.filenames
else:
else:
files=get_all_files(rootdir)
files=get_all_files(rootdir)
files=normalize_files(rootdir,files)
check_known_flags(rootdir)
flags=get_flags(rootdir,files)
flagRE=flags_to_re(flags)
bad_lines=[]
# walk all the file looking for any flag that was declared and now has an _
forpathnameinfiles:
relname=os.path.relpath(pathname,rootdir)
f=open(pathname,'r')
forlineinf.read().splitlines():
ifline_has_bad_flag(line,flagRE):
if(relname,line)notinexceptions:
bad_lines.append((relname,line))
f.close()
iflen(bad_lines)!=0:
check_underscore_in_flags(rootdir,files)
ifnotargs.skip_exceptions:
print("Found illegal 'flag' usage. If these are false negatives you should run `hack/verify-flags-underscore.py -e > hack/verify-flags/exceptions.txt` to update the list.")