Open alonme opened 3 years ago
For use in CI you probably want to use nbstripout
as a pre-commit hook.
I am not using (and currently cannot use) pre-commit ci.
Also - i don't want to alter files in my CI (server side, not locally before commits).
So i need to get some indication regarding if files were changed, which is AFAIU not currently available from the tool?
No, this is not currently support. It's not necessary when used as a pre-commit hook, as the default behavior of the hook is to fail if any changes would have been made.
What you're asking for I'd probably think of as a --verify
option. The difficulty in implementing this is the same as mentioned in #152 .
Adding this as a feature request to the backlog.
It would be awesome to have this option.
Feel like contributing this feature @yliederNY ? :)
@alonme @yliederNY one of you interested in working on this?
Hello there!
I like the idea of a --verify
flag! I will try to make a PR for it sometime soon!
Just so we are clear, the. --verify would act as dry run but exit with status 1 when at least one of the files would have been stripped, and should be consistent to --dry-run in terms of stdout/stderr, right?
best!
@jspaezp Yes, what you describe sounds reasonable to me 👍🏽
Also would love this functionality.
I looked into it but with the current structure it leads to a lot of branching. It is doable but without some refactoring the ending code is very ugly. -> https://github.com/kynan/nbstripout/pull/192 reference (it is off a fairly old branch so it cannot be merged RN but the idea is the same ..)
Thanks @jspaezp for looking into this! As mentioned on your PR it's unfortunately not currently in a reviewable state. Could you please rebase on the tip of main?
Just sent a PR with the new main (after the refactor done it was a lot easier to add the feature, thanks for the code cleanup!)
In order to use this tool in CI, it would be useful if it could return an error code when a file has been changed/ would have been changed (when using dry_run)