If you're using Claude try the hookify plugin and ask if to block commits unless the rules pass.