Only the 5 default-subset codes; the rest of tryceratops is opt-in.
- 9 TRY201 (raise e -> raise) autofixed, preserving the traceback
identically while dropping the redundant exception name
- 26 TRY401 (redundant exception object passed to logger.exception,
which already logs it) fixed by removing the duplicate from the
message; three sites still needed the exception object for
something else (re-raising, or a separate logger.error call) and
kept their binding
- 6 TRY002 (raise bare Exception): 2 production sites (documents/
matching.py, paperless_mail/preprocessor.py) got dedicated
exception classes, with their tests narrowed to match instead of
asserting a blind Exception; the other 4 are deliberate generic
failures in test doubles/fixtures, suppressed with noqa
3 B009 (getattr with a constant string, rewrite as attribute access)
hits autofixed. 7 B017 (assert blind Exception) hits: one narrowed
to the actual ValueError raised by bulk_edit.edit_pdf, the other six
suppressed with noqa since the code under test genuinely raises (or
a mock genuinely injects) a bare Exception, so a narrower assertion
would be wrong.
Only the 29 B codes ruff 0.16 enables by default; the rest of
flake8-bugbear needs a separate, deliberate decision.