From e50a90cc9f7da5315cbc59a3c5947ce587e8c403 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 2 Sep 2024 14:31:33 +0500 Subject: [PATCH] ifcopenshell.validate return code 1 in case of some file is invalid --- src/ifcopenshell-python/ifcopenshell/validate.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ifcopenshell-python/ifcopenshell/validate.py b/src/ifcopenshell-python/ifcopenshell/validate.py index 299e475297..d5dd1ac3bc 100644 --- a/src/ifcopenshell-python/ifcopenshell/validate.py +++ b/src/ifcopenshell-python/ifcopenshell/validate.py @@ -600,6 +600,7 @@ if __name__ == "__main__": filenames = [x for x in sys.argv[1:] if not x.startswith("--")] flags = set(x for x in sys.argv[1:] if x.startswith("--")) + some_file_is_invalid = False for fn in filenames: handler = None @@ -636,5 +637,10 @@ if __name__ == "__main__": else: # json_logger. invalid_ifc = bool(logger.statements) - if not invalid_ifc: + if invalid_ifc: + some_file_is_invalid = True + else: print("No validation issues found.") + + if some_file_is_invalid: + exit(1)