Open janosh opened 2 years ago
I can definitely see that use case, however isn't the point (and mode of operation) of the pre-commit hook that it'll fail if it would make any changes to the working tree? Correct me if I'm wrong, as I don't use nbstripout in this mode, so I'm stating this based on some light testing I'd done quite a while ago and some other issues that have been raised on the pre-commit use case.
pre-commit
hooks can be both linters and formatters. Formatters should fix violations themselves, linters only flag them. Any hook can also be a combination of both, i.e. fix some violations automatically and report others.
Fair enough! Are you interested in working on this @janosh ? As I don't use nbstripout in this mode I think this would ideally be implemented by someone who can test it and ensure the feature works as intended.
I won't be able to work on implementing this. Contributions welcome!
The
--max-size
flag added in #135 is a great addition! 👍When using
nbstripout
as commit hook, it would be nice to have a slightly safer mode that doesn't auto-remove output exceeding the max size but rather raises an error to abort the commit and let the developer handle it on a case by case basis (maybe compress rather than remove the cell output).