ruff icon indicating copy to clipboard operation
ruff copied to clipboard

New check: B040

Open Zac-HD opened this issue 1 year ago • 2 comments

https://github.com/PyCQA/flake8-bugbear/issues/474 / https://github.com/PyCQA/flake8-bugbear/pull/477

Zac-HD avatar Jun 29 '24 04:06 Zac-HD

Makes sense to me!

zanieb avatar Jun 29 '24 04:06 zanieb

note that I explicitly decided not to cover some thorny cases, but given you have the full logic for unused variables already, I think it might make sense for you to cover them. See discussion in the linked PR and the end of the file with test cases

jakkdl avatar Jun 29 '24 16:06 jakkdl

Hey! I've been using this crate for some time now and I'd love to contribute back! However, I'm a bit confused by the initial comment, what exactly are we trying to fix?

Heidar-An avatar Jul 30 '24 12:07 Heidar-An

We'd like to implement the new lint rule from upstream - this is basically a 'please port it' feature request!

Zac-HD avatar Jul 30 '24 16:07 Zac-HD

@Zac-HD Hi, I have added the rule that covers the same set of errors as one in upstream and even covers the unhandled cases there. Currently it only doesn't cover the reassignment of the exception like

try:
    ...
except Exception as e:
    e2 = ValueError()  # should error
    e2.add_note(str(e))

divident avatar Aug 08 '24 21:08 divident