ruff icon indicating copy to clipboard operation
ruff copied to clipboard

PyUpgrade: Turn errors into OSError

Open colin99d opened this issue 2 years ago • 9 comments
trafficstars

A part of #827. The following needs to be happen for this to be moved out of draft status:

  • [x] Handle statements with multiple except statements
  • [x] Handle raise statements
  • [x] Add the rest of the tests from pyupgrade

colin99d avatar Dec 29 '22 02:12 colin99d

@colin99d - Is this all set to review?

charliermarsh avatar Dec 29 '22 18:12 charliermarsh

@charliermarsh I got this done and we are passing all pyupgrade tests. I intentionally left it a little messy because I figured it would need refactored, and I wanted your input on how. This one was a lot more code because there were a lot more possible situations. Also please show me how to get Located<ExprKind> out of the box, so that I only need two implement my trait for two types. I tried using (*item).downcast::<Located<ExprKind>>(), but rust was saying that Box<Located<ExprKind>> has no method downcast (same with downcast_ref).

colin99d avatar Dec 29 '22 18:12 colin99d

Ok thanks, I'll try to review today!

charliermarsh avatar Dec 29 '22 18:12 charliermarsh

(And will look to answer your questions too.)

charliermarsh avatar Dec 29 '22 18:12 charliermarsh

Perfect! Also is there a Discord server or something similar for people contributing to chat on?

colin99d avatar Dec 29 '22 18:12 colin99d

There's not, but I've considered creating one 🤔

charliermarsh avatar Dec 29 '22 22:12 charliermarsh

There's not, but I've considered creating one 🤔

Would be nice just so that I can know where you plan on taking this thing and how I can help it get there. You could make it private for now if your worried about spammers and randos.

colin99d avatar Dec 29 '22 23:12 colin99d

Switched this to draft until I get done with all our changes.

colin99d avatar Dec 30 '22 03:12 colin99d

@charliermarsh I am switching this out of draft now. Unfortunately, trying to consolidate to two implementations caused tests to fail, so I did not do it. Let me know if you want anything else cleaned up or more comments anywhere else.

colin99d avatar Dec 30 '22 16:12 colin99d

Going to revisit this tomorrow!

charliermarsh avatar Dec 31 '22 04:12 charliermarsh

Perfect! Also is there a Discord server or something similar for people contributing to chat on?

@charliermarsh If you’re interested, Zulip will happily sponsor free Zulip Cloud hosting for Ruff (as we do for any open-source project).

andersk avatar Jan 02 '23 04:01 andersk