Chore: enable flake8-bugbear (B) default-subset ruff rules

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.
This commit is contained in:
stumpylog
2026-09-01 15:03:17 -07:00
parent a6b1763149
commit 0ef5ef5826
8 changed files with 39 additions and 10 deletions
@@ -184,7 +184,7 @@ class TestMailMessageGpgDecryptor(TestMail):
EMAIL_GNUPG_HOME=empty_gpg_home,
):
message_decryptor = MailMessageDecryptor()
self.assertRaises(Exception, message_decryptor.run, encrypted_message)
self.assertRaises(Exception, message_decryptor.run, encrypted_message) # noqa: B017 - raises a bare Exception on decryption failure
finally:
# Clean up the temporary GPG home used only by this test
try: