Start enforcing the Ruff RUF rules#251
Merged
Merged
Conversation
eerovaher
commented
May 18, 2026
| aob, zob, hob, dob, rob, eo = erfa.atco13( | ||
| ra[:, None, None], dec[None, :, None], 0.0, 0.0, 0.0, 0.0, jd[None, None, :], | ||
| 0.0, 0.0, 0.0, np.pi/4.0, 0.0, 0.0, 0.0, 1014.0, 0.0, 0.0, 0.5) | ||
| (aob.shape) == (5, 4, 121) |
Contributor
Author
There was a problem hiding this comment.
There is no assert here, so this was a useless comparison. The Ruff rule B015 (useless-comparison) would guard against mistakes like that, but we haven't turned on the B rules yet.
avalentino
reviewed
May 19, 2026
| [ | ||
| pytest.param(0.0, 0.0, 2456855.5, (), id="scalar"), | ||
| pytest.param( | ||
| 0.0, 0.0, np.linspace(2456855.5, 2456856.5, 5), (5,), id="simple array" |
Member
There was a problem hiding this comment.
This does not look like the original one
Do I miss something?
Contributor
Author
There was a problem hiding this comment.
I made the arrays smaller because I didn't see the point in forcing the tests to run with larger arrays, but the tests are still checking that the output shape is correct. I did also change the range of jd values to shorten setup, but that shouldn't matter because with or without my patch the asserts here only care about the shape of the outputs, not about the values within.
avalentino
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I am configuring Ruff to enforce its RUF rules. There were two kinds of RUF violations that had to be fixed.
docs/conf.pycontained non-ASCII characters that are visually indistinguishable or almost indistinguishable from ASCII characters. Personally I am not opposed to using non-ASCII characters when they improve readability (e.g. writingαinstead ofalpha), but visually indistinguishable characters cannot possibly do that.In
erfa/tests/test_erfa.pyRuff pointed out several unused unpacked variables. If apyerfaPython wrapper function returns atupleit will have named attributes, so if only one or two values are needed then unpacking the tuple does not improve readability. I've rewritten the test in question as two separate parametrized tests.