From 9fb82ed4f5ea1689fe602acf6effe3ef7c26bb71 Mon Sep 17 00:00:00 2001 From: Ronny Vedrilla Date: Tue, 20 Aug 2024 17:00:30 +0200 Subject: [PATCH] Whitelisted model causes wrong return code of "scrub_validaton" command --- django_scrubber/management/commands/scrub_validation.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/django_scrubber/management/commands/scrub_validation.py b/django_scrubber/management/commands/scrub_validation.py index 5db8b34..f06bbe8 100644 --- a/django_scrubber/management/commands/scrub_validation.py +++ b/django_scrubber/management/commands/scrub_validation.py @@ -31,7 +31,8 @@ def handle(self, *args, **options): print(f"- {field}") found_fields += 1 - print(f'{found_models} model(s) having {found_fields} unscrubbed field(s) detected.') - sys.exit(1) + if found_models > 0 or found_fields > 0: + print(f'{found_models} model(s) having {found_fields} unscrubbed field(s) detected.') + sys.exit(1) print('No unscrubbed fields detected. Yeah!')