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 pre-commit with ruff #36

Merged
merged 3 commits into from
Jul 25, 2024
Merged

Conversation

tomwhite
Copy link
Contributor

Based on bio2zarr's set up

(This includes #35 which should be merged first, then I'll rebase this)

@jeromekelleher
Copy link
Contributor

Thanks Tom!

@tomwhite
Copy link
Contributor Author

This should be ready to merge when you're ready @jeromekelleher

Copy link
Contributor

@jeromekelleher jeromekelleher left a 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 \
Copy link
Contributor

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)

@@ -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 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same problem here

@tomwhite
Copy link
Contributor Author

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.

@jeromekelleher jeromekelleher merged commit 6279604 into sgkit-dev:main Jul 25, 2024
9 checks passed
@jeromekelleher
Copy link
Contributor

Great - thanks!

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

Successfully merging this pull request may close these issues.

2 participants