Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --check CLI option similar to Black for CI usage #186

Open
skilkis opened this issue Jun 17, 2021 · 6 comments
Open

Add --check CLI option similar to Black for CI usage #186

skilkis opened this issue Jun 17, 2021 · 6 comments

Comments

@skilkis
Copy link

skilkis commented Jun 17, 2021

@nschloe thanks for the awesome package, I'm enjoying using it so far! A feature request would be to have a --check option similar to the black code formatter that results in a non-zero exit code if betterbib were to make any changes. This would primarily be useful to use in CI services to check if the .bib file is up-to-date and has the right formatting.

@nschloe
Copy link
Collaborator

nschloe commented Jun 23, 2021

I don't think it'd be useful for betterbib or betterbib-sync, but it could perhaps added to betterbib-format.

@skilkis
Copy link
Author

skilkis commented Jun 24, 2021

@nschloe the main use-case I have in mind would be to reject a PR if a bibliography file wasn't run through betterbib before a commit. What do you think?

@nschloe
Copy link
Collaborator

nschloe commented Jun 24, 2021

What do you think?

For sync it's not such a good idea because the online sources change once in a while which would suddenly break your tests.

@skilkis
Copy link
Author

skilkis commented Jun 25, 2021

It's not a bug it's a feature 😂 Let's see if anyone else has a use for this feature request, otherwise I can implement the desired functionality with a diff as well. Thanks for the quick replies @nschloe

@JensHeinrich
Copy link

Dirty hack for you @skilkis :
Use the pre-commit hook and pack it into your ci.
If betterbib formatchanges anything, the hook fails

@skilkis
Copy link
Author

skilkis commented Sep 17, 2021

@JensHeinrich that's a great suggestion! pre-commit would work well for this 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants