-
Notifications
You must be signed in to change notification settings - Fork 4
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 pre-commit with ruff #36
Conversation
Thanks Tom! |
This should be ready to merge when you're ready @jeromekelleher |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, looks like Ruff is introducing extra white space into our string literals which is pretty irritating. Is there a way to turn off this auto "fixing"?
tests/utils.py
Outdated
@@ -114,11 +114,13 @@ def assert_vcfs_close(f1, f2, *, rtol=1e-05, atol=1e-03): | |||
val2, | |||
rtol=rtol, | |||
atol=atol, | |||
err_msg=f"FORMAT {field} not equal for variants\n{v1}{v2}", | |||
err_msg=f"FORMAT {field} not equal for \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think ruff is changing the actual strings here. In this program
string = "this is a \
string with\
different levelts of indentation"
print(string)
the leading whitespace isn't removed from the string literal.
Can we change to using string concatenation instead?
(Ruff seems to do this sort of thing quite a bit - it has extremely strong opinions that aren't necessarily all that well supported)
vcztools/vcf_writer.py
Outdated
@@ -54,7 +55,8 @@ | |||
"HQ": "Haplotype quality", | |||
"MQ": "RMS mapping quality", | |||
"PL": "Phred-scaled genotype likelihoods rounded to the closest integer", | |||
"PP": "Phred-scaled genotype posterior probabilities rounded to the closest integer", | |||
"PP": "Phred-scaled genotype posterior probabilities rounded to the closest \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same problem here
I fixed it incorrectly before - this should be better now. I think Black didn't change these lines, but Ruff is stricter, as you say. |
Great - thanks! |
Based on bio2zarr's set up
(This includes #35 which should be merged first, then I'll rebase this)