nbstripout icon indicating copy to clipboard operation
nbstripout copied to clipboard

Option to error on cell outputs exceeding `--max-size`

Open janosh opened this issue 1 year ago • 4 comments

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).

janosh avatar Aug 19 '22 18:08 janosh

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.

kynan avatar Sep 24 '22 17:09 kynan

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.

janosh avatar Oct 01 '22 19:10 janosh

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.

kynan avatar Oct 02 '22 10:10 kynan