Skip to content
Advertisement

The regx in pygrep always returns True

I’m using the pygrep in pre-commit and here is my settings:

JavaScript

I want to check the commit message format but no mater what I entered, it always returns true.

JavaScript

Advertisement

Answer

you also commented on github! pick one in the future not both!

your regex doesn’t follow the pattern I outlined in that issue you commented on — here is the example I used:

JavaScript

note that we’re using a negative lookahead — by default pygrep is used to find problems with things and you’re trying to do the opposite

right now your current pattern will only fail on correctly named things rather than only allow correctly named things

adapting your pattern to the one I outlined in the issue you’d want something like:

JavaScript

disclaimer: I created pre-commit

Advertisement