Files
leadchat/.husky/pre-commit
Shivam Mishra 76650c86cd 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.
2023-02-24 17:15:11 +05:30

12 lines
326 B
Bash
Executable File

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
# lint js and vue files
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 --force-exclusion -a
# stage rubocop changes to files
git diff --name-only --cached | xargs git add