Open rcomer opened 1 year ago
@rcomer Thanks for this :rocket:
I was waiting for https://github.com/SciTools/iris/discussions/5254 to conclude, then reopen SciTools/iris#353, but totally happy to replace it with this :+1:
Rebased, updated the ruff version and replaced black with ruff's formatter.
Swapping black for ruff's formatter only affects one line, shown in the most recent commit.
We now have more failures and fewer autofixes from main ruff. I think because some fixes that were previously done automatically are now marked "unsafe" so we would need to manually opt in (see https://astral.sh/blog/ruff-v0.1.0#respecting-fix-safety).
I applied the "unsafe" fixes but then tweaked a few that didn't look quite right to me. Also tidied up the remaining errors so I think this is now ready for review.
Unlike most of my branches, the individual commits here may be meaningful enough to review individually.
@SciTools/peloton would you be interested in taking this on, @tkknight ? We think you expressed interest in getting this one in before the Iris one, and that @bjlittle is unlikely to find time right now.
New commit dismissed an approving review. Not seen that before π
π Pull Request
Description
SciTools/iris#353 proposed introducing ruff to cf-units for linting, but also changed some style choices (max line length and import sort order). IMO this made it difficult to spot what effect ruff was having on the code. This PR breaks it down so hopefully it's easier to see what's going on:
dict(...)
to{...}
- maybe for speed?if thing == None
toif thing is None
- I'm surprisedflake8
didn't catch that oneCI will fail with remaining problems that ruff found: