rhythmic-morning-87313
07/06/2022, 3:16 PM./pants fmt has made actual changes or not? I'd like to use it in the pre-commit hook but I don't want to blindly run git add -u but just abort the commit when there are changed files.curved-television-6568
07/06/2022, 3:24 PM./pants lint it will fail if there would be changes made by `fmt`… does that help?rhythmic-morning-87313
07/06/2022, 3:24 PMrhythmic-morning-87313
07/06/2022, 3:25 PMcurved-television-6568
07/06/2022, 3:25 PM./pants lint fmt you will not get to fmt if there are changes to be made… and if your run ./pants fmt lint you won’t catch changes made by fmt in lint… so I’m not sure what you meant there… 🙂rhythmic-morning-87313
07/06/2022, 3:26 PMrhythmic-morning-87313
07/06/2022, 3:26 PMfmt if required
• abort the commit by returning exit code 1 if we had to make changesrhythmic-morning-87313
07/06/2022, 3:26 PMrhythmic-morning-87313
07/06/2022, 3:27 PMgit add -u always after ./pants fmt in the git pre-commit hookcurved-television-6568
07/06/2022, 3:27 PMlint)rhythmic-morning-87313
07/06/2022, 3:27 PMcurved-television-6568
07/06/2022, 3:28 PMrhythmic-morning-87313
07/06/2022, 3:29 PMrhythmic-morning-87313
07/06/2022, 3:29 PM./pants fmt should be run by human...rhythmic-morning-87313
07/06/2022, 3:29 PMcurved-television-6568
07/06/2022, 3:29 PMrhythmic-morning-87313
07/06/2022, 3:30 PMclean-city-64472
07/06/2022, 4:31 PMlint on a pre-commit hook. I think if you want to automated fmt you should do it in your editor. I wired up vim to run black and isort on save.witty-crayon-22786
07/06/2022, 4:44 PMfmt is also checked in `lint`: so lint will definitely fail if fmt needs to run (it might also fail for non-autoformatters)wide-midnight-78598
07/06/2022, 7:05 PMfmt isn't run automatically, but also gives hints to the user:
https://sureshjoshi.com/development/pants-plugin-code-quality#pre-commit-hooks