bin/find-unneeded-includes | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
New commits: commit 3f618170b8474b4a4e97aa7685daf064d0413a57 Author: Gabor Kelemen <[email protected]> AuthorDate: Wed Jul 14 00:24:50 2021 +0200 Commit: Miklos Vajna <[email protected]> CommitDate: Wed Jul 14 11:28:49 2021 +0200 find-unneeded-includes: add --recursive option so that f-u-i will be able to find files to check on its own. Previously you had to find foo -name "*cxx" | xargs bin/f-u-i Now its a bit easier to mass-check files. Change-Id: I2823832ce8335a30493cf9f538f6fc5baec42dde Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118875 Tested-by: Jenkins Reviewed-by: Miklos Vajna <[email protected]> diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes index fbda1007adfd..9b38fd524f49 100755 --- a/bin/find-unneeded-includes +++ b/bin/find-unneeded-includes @@ -308,6 +308,8 @@ def main(argv): help='Don\'t stop on errors. Useful for periodic re-check of large amount of files') parser.add_argument('Files' , nargs='*', help='The files to be checked') + parser.add_argument('--recursive', metavar='DIR', nargs=1, type=str, + help='Recursively search a directory for source files to check') args = parser.parse_args() @@ -315,6 +317,15 @@ def main(argv): parser.print_help() return + list_of_files = [] + if args.recursive: + for root, dirs, files in os.walk(args.recursive[0]): + for file in files: + if (file.endswith(".cxx") or file.endswith(".hxx") or file.endswith(".hrc") or file.endswith(".h") or file.endswith(".c")): + list_of_files.append(os.path.join(root,file)) + else: + list_of_files = args.Files + try: with open("compile_commands.json", 'r') as compileCommandsSock: compileCommands = json.load(compileCommandsSock) @@ -322,7 +333,7 @@ def main(argv): print ("File 'compile_commands.json' does not exist, please run:\nmake vim-ide-integration") sys.exit(-1) - tidy(compileCommands, paths=args.Files, dontstop=args.dontstop) + tidy(compileCommands, paths=list_of_files, dontstop=args.dontstop) if __name__ == '__main__': main(sys.argv[1:]) _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
