summaryrefslogtreecommitdiffstats
path: root/bin/find-unneeded-includes
diff options
context:
space:
mode:
authorGabor Kelemen <kelemen.gabor2@nisz.hu>2021-07-14 00:24:50 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-07-14 11:28:49 +0200
commit3f618170b8474b4a4e97aa7685daf064d0413a57 (patch)
treeb779142619e84fbf8e7b680d11c8c21a63cdf5d8 /bin/find-unneeded-includes
parentAdd Handler for ClipRegion Read (diff)
downloadcore-3f618170b8474b4a4e97aa7685daf064d0413a57.tar.gz
core-3f618170b8474b4a4e97aa7685daf064d0413a57.zip
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 <vmiklos@collabora.com>
Diffstat (limited to 'bin/find-unneeded-includes')
-rwxr-xr-xbin/find-unneeded-includes13
1 files changed, 12 insertions, 1 deletions
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:])