From 7d436627b69f9036f29ed8562dcc0202aca446e7 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Mon, 10 Feb 2025 22:23:29 +0100 Subject: [PATCH] chore(lefthook): detect unwanted data --- snippets/grep.fish | 5 +++++ snippets/lefthook.yml | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 snippets/grep.fish create mode 100644 snippets/lefthook.yml diff --git a/snippets/grep.fish b/snippets/grep.fish new file mode 100644 index 0000000..d229829 --- /dev/null +++ b/snippets/grep.fish @@ -0,0 +1,5 @@ +#!/usr/bin/env fish + +# Check unwanted data +# Show file name and line number +! grep -EHinr -e 'some' -e 'regexp' * || ( echo 'unwanted data found' >&2 && false ) diff --git a/snippets/lefthook.yml b/snippets/lefthook.yml new file mode 100644 index 0000000..5a43957 --- /dev/null +++ b/snippets/lefthook.yml @@ -0,0 +1,7 @@ +--- +pre-commit: + commands: + check-unwanted-data: + run: >- + ! ( grep -Hin -e 'example.org' -e '012345678901' {staged_files} ) + || ( printf %b '\n' 'found possibly unwanted data' >&2 && false )