Refactoring and fixes
What does this MR do?
Refactor the code with readability in mind. Also, it fixes the way exit codes are handled when running the tools (gitleaks and others).
This is ~backstage and doesn't change the behavior, so there's no need to update the changelog. Tests also remain the same.
Edited by Fabien Catteau