0

It seems pre-commit exits with code 0 if everything is fine, and exit code 1 if any checks Fail - regardless of reason.

Is there a way (programmatically) to differentiate between failures that resulted in files being modified (thereby fixing the problem) vs a problem that requires a user (like "E501 line too long")?

anthony sottile
  • 61,815
  • 15
  • 148
  • 207
odigity
  • 7,568
  • 4
  • 37
  • 51

1 Answers1

2

short answer: no

slightly longer answer: no but also it also would be impossible to know if all linting would pass after formatting plus tools can both modify files and at the same time produce "errors"


disclaimer: I wrote pre-commit

anthony sottile
  • 61,815
  • 15
  • 148
  • 207
  • For my purpose, I'm considering running it twice, and if it succeeds the second time, treating that as an "autorepair" event instead of a "blocker". – odigity Jan 29 '23 at 05:41