From 76650c86cd38ef44602900c514c91cfb77cc8899 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Fri, 24 Feb 2023 17:15:11 +0530 Subject: [PATCH] chore: add `--force-exclusion` option (#6535) The pre-commit hook would format event those files excluded in the config. This is because the files were passed as args instead of the linter running on the entire project. When this happens, the exclude is not respect. The --force-exclusion flag instructs our machine overlords to force exlucde files specified in the configuration Exclude even if they are explicitly passed as arguments. --- .husky/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 9984ac506..adda426ad 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -5,7 +5,7 @@ npx --no-install lint-staged # lint only staged ruby files -git diff --name-only --cached | xargs ls -1 2>/dev/null | grep '\.rb$' | xargs bundle exec rubocop -a +git diff --name-only --cached | xargs ls -1 2>/dev/null | grep '\.rb$' | xargs bundle exec rubocop --force-exclusion -a # stage rubocop changes to files git diff --name-only --cached | xargs git add