observing/pre-commit

pre-commit hook not working on macos

LucasBourgeois opened this issue · 0 comments

Hi,

Im facing an issue using this package.
Here is actual command im using :
git diff --cached --name-only --diff-filter=ACM | grep -E '\.(js|jsx|ts|tsx)$' | xargs -r -P $(nproc) -I {} -n 1 eslint -c .eslintrc.json --max-warnings 0 '{}'
It's getting updated file names and is running eslint for every of those files.

Even if eslint is giving error and error code exit 1; pre-commit isnt stopping commit to being added.
nproc is a linux process, i created a polyfill of this in usr/local/bin of nproc to do the same but for mac.
actually, i could use an integer instead of $(nproc)

The problem is that it's working perfectly on linux.
But on macos, exit code is 0 and not 1.
Even if i replace this long command by a simple "exit 1;" pre-commit still allow commit to be done.

It appears that there is an issue on macos but i really don't know what.

any idea ?

Im on macos ventura.
pre-commit version : ^1.2.2
Node version : 19
Git version : 2.39