From a3c99e069ccf91a22d67ed36fec73554a12dbfa1 Mon Sep 17 00:00:00 2001 From: Jordan Storms Date: Thu, 1 Jul 2021 14:13:17 -0400 Subject: [PATCH] fix custom hook logic --- .git-hooks/detect-api-keys.py | 12 ++++++------ .pre-commit-config.yaml | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.git-hooks/detect-api-keys.py b/.git-hooks/detect-api-keys.py index a050de76..8d4092a9 100755 --- a/.git-hooks/detect-api-keys.py +++ b/.git-hooks/detect-api-keys.py @@ -61,12 +61,12 @@ def main(argv=None): if match != None: files_with_key.append((name, filename, i + 1, match.end())) - if files_with_key: - for file in files_with_key: - print(key_found_message(file)) - return 1 - else: - return 0 + if files_with_key: + for file in files_with_key: + print(key_found_message(file)) + return 1 + else: + return 0 if __name__ == "__main__": diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2b056502..8d793e0b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,3 +16,4 @@ repos: description: Checks for AWS or Datadog API keys entry: ".git-hooks/detect-api-keys.py" language: python + exclude: tests