bin/find-unneeded-includes |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit 655e5d4406e15774a76c945a57700d21516813c1
Author:     Gabor Kelemen <kelem...@ubuntu.com>
AuthorDate: Mon Apr 18 14:54:26 2022 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Apr 25 08:43:38 2022 +0200

    find-unneeded-includes: bail out early if no files are found with 
--recursive
    
    Change-Id: I5bd726b33e4fc7068baad91ff185763274307b35
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133308
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index f58677c48bb7..cc694fcb41a6 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -346,6 +346,13 @@ def main(argv):
 
     # quickly sanity check whether files with exceptions in yaml still exists
     # only check for the module of the very first filename passed
+
+    # Verify there are files selected for checking, with --recursive it
+    # may happen that there are in fact no C/C++ files in a module directory
+    if not list_of_files:
+        print("No files found to check!")
+        sys.exit(-2)
+
     moduleName = sorted(list_of_files)[0].split("/")[0]
     rulePath = os.path.join(moduleName, "IwyuFilter_" + moduleName + ".yaml")
     moduleRules = {}

Reply via email to