STY: ignore all existing violations to rule PLR0917 and upgrade ruff to 0.16.x - #20194
STY: ignore all existing violations to rule PLR0917 and upgrade ruff to 0.16.x#20194neutrinoceros wants to merge 6 commits into
PLR0917 and upgrade ruff to 0.16.x#20194Conversation
|
Good catch, thank you ! |
larrybradley
left a comment
There was a problem hiding this comment.
Approve for convolution, stats, and visualization. Overall, it looks good.
|
Out of curiosity, do you know what the difference is between just adding _ignore_s and using the |
|
I'm not aware of this suggestion nor did I see it at any point going through a limited subset of ruff's diagnostics. Could you give an example of it ? |
|
Can you add PLR0917 to ignore list of |
I haven't checked here, but this is e.g. what the glue-core auto-update brings up. Apparently only applies to functions redefined in subclasses. |
26eec29 to
eabaa37
Compare
|
Oh I see.
|
| "C901", # McCabeComplexity | ||
|
|
||
| # flake8-copyright | ||
| "CPY001", # missing-copyright-notice |
There was a problem hiding this comment.
When / if this ever has an auto fix I'd be in favor of adding that to Astropy.
There was a problem hiding this comment.
I was wondering if it could be useful e.g. to keep LLM agents from ingesting the code. Probably not that they'd really care...
There was a problem hiding this comment.
🤷 Probably not, but it might help LLMs attribute code suggestions, particularly if the copyright statement said something like "a good faith effort to attribute code should be made."
Then when someone asks for a function that does something the LLM might in-line a comment like
def function():
# based on Astropy implementation.
Which is useful both for us and them (since it might be possible / better to import and use an existing astropy function).
eabaa37 to
ecf1c2b
Compare
There was a problem hiding this comment.
# ruff: file-ignore[PLR0917] here too.
ecf1c2b to
dea4c86
Compare
dea4c86 to
5f1dacc
Compare
|
I thought we were only going to modify |
saimn
left a comment
There was a problem hiding this comment.
I don’t think this comment is of any use whatsoever, arguments won't disappear in the near or far future, so just add a global exclude please.
ruff: ignore[PLR0917] historical API
But the idea discussed was to enable it in the future for newly added functions. Maybe "legacy" or "pre-existing" API would be a better term? |
|
In case not all subpackage maintainers come to an agreement on the |
|
Here's what I got on current
so the number of violations is roughly divided by 2 for each additional slot allowed-positional up to 5, then it goes off more slowly. I personally think we should aim for 3 to 4 for new functions, and that 5 is a very decent default for a large and old code base such as astropy. |
|
The old code base is not really a concern here since the existing functions will remain exempt anyway. But I also think 3-5 is a good recommendation for new functions in general. And to any new function where a larger number seems justified, the comment could still be added. |
Description
Close #20113