summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorGabor Kelemen <kelemeng@ubuntu.com>2022-02-13 15:27:41 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-02-15 09:28:44 +0100
commitad1cc7420ff87745ef6981a85e4e0122f8d8a9e3 (patch)
tree5f38326aa81fb31eb424261a490cf706281219fb /bin
parent400d36a9a04ae3568d3430b7519cf1e23f9686d4 (diff)
find-unneeded-includes: check existence of files listed in yaml files
It might happen that some files are removed/renamed warn about such files to adjust filter rules Change-Id: Ib8f1c586a67310cc8be04edfcc75f655da2dbfe0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129881 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/find-unneeded-includes15
1 files changed, 15 insertions, 0 deletions
diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index bdff09bf23eb..8197e9bf6814 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -28,6 +28,7 @@ import sys
import threading
import yaml
import argparse
+import pathlib
def ignoreRemoval(include, toAdd, absFileName, moduleRules):
@@ -341,6 +342,20 @@ def main(argv):
print ("File 'compile_commands.json' does not exist, please run:\nmake vim-ide-integration")
sys.exit(-1)
+ # quickly sanity check whether files with exceptions in yaml still exists
+ # only check for the module of the very first filename passed
+ moduleName = sorted(list_of_files)[0].split("/")[0]
+ rulePath = os.path.join(moduleName, "IwyuFilter_" + moduleName + ".yaml")
+ moduleRules = {}
+ if os.path.exists(rulePath):
+ moduleRules = yaml.full_load(open(rulePath))
+ if "excludelist" in moduleRules.keys():
+ excludelistRules = moduleRules["excludelist"]
+ for pathname in excludelistRules.keys():
+ file = pathlib.Path(pathname)
+ if not file.exists():
+ print("WARNING: File listed in " + rulePath + " no longer exists: " + pathname)
+
tidy(compileCommands, paths=list_of_files, dontstop=vars(args)["continue"])
if __name__ == '__main__':