-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Make Badge newline configurable or only update if content changed #40
Comments
Hey @s-weigand ! My apologies for not following up on this issue earlier. This seems like a common issue when folks collaborate using different OSes, not necessarily something that |
The problem I have is, when I want to run it with My use case is on Windows with interrogate/src/interrogate/badge_gen.py Lines 33 to 47 in 4ed5c40
IMHO the most elegant way to solve this, would be an "only update if needed"/"lazy" strategy and since this package is already python 3.5+ one could use pathlib and the check could (... I guess) be as nice and clean as:
if bage_path.read_text() == badge:
bage_path.write_text(badge) If you like the idea of the "lazy" strategy, I can give it a try in a PR. Reproducing the problemTo reproduce this you will need a Windows or MacOs system (vm for windows/no easy way to spin up MacOs in a VM for testing I know) or change your line ending in
|
Hmm yeah that does make sense now; thank you for the explanation. It didn't connect with me first with the fact that I like the "lazy" idea better - adding another CLI arg seems a bit more clumsy IMO. But I will definitely appreciate a PR if you have some time to spare! Thanks! |
Instead of always generating a badge, first check to see if there’s an existing badge, and if so, do not generate a badge if the existing badge contains the same results. Addresses #40
Hopefully is addressed in #47 in version 1.3.1. Please reopen if not! |
Instead of always generating a badge, first check to see if there’s an existing badge, and if so, do not generate a badge if the existing badge contains the same results. Addresses econchick/interrogate#40
Describe the feature you'd like
First of all thanks for the awesome tool 😄
I would love to use the badge creation feature as a
pre-push
hook in my projects, so the badge is always up to date.But since each major OS has its own newline (Linux
\n
, MacOs '\r' and Windows\r\n
), creating a new badge on push can lead to a diff, which basically is empty, blocking the push.Since my projects (as most others I guess) are setup to have
\n
as newline, it would be nice to havebadge_newline
as a configurable option (this can be done with a kwarg in open).Alternative solution
Another alternative would be to check if the text in
interrogate_badge.svg
did change and only write changes if that is the case.That way the new line cofiguration would be left to the user (i.e. via
.gitattributes
), an not clutter the CLI and config ofinterrogate
.Is your feature request related to a problem?
Badge creation blocks usage with
pre-commit
.Your Environment
interrogate
version(s) (interrogate --version
: 1.2.0The text was updated successfully, but these errors were encountered: