282 ), |
282 ), |
283 ## Bugbear |
283 ## Bugbear |
284 "M501": QCoreApplication.translate( |
284 "M501": QCoreApplication.translate( |
285 "MiscellaneousChecker", |
285 "MiscellaneousChecker", |
286 "Do not use bare 'except:', it also catches unexpected events like memory" |
286 "Do not use bare 'except:', it also catches unexpected events like memory" |
287 " errors, interrupts, system exit, and so on. Prefer 'except Exception:'." |
287 " errors, interrupts, system exit, and so on. Prefer excepting specific" |
288 " If you're sure what you're doing, be explicit and write" |
288 " exceptions. If you're sure what you're doing, be explicit and write" |
289 " 'except BaseException:'.", |
289 " 'except BaseException:'.", |
290 ), |
290 ), |
291 "M502": QCoreApplication.translate( |
291 "M502": QCoreApplication.translate( |
292 "MiscellaneousChecker", |
292 "MiscellaneousChecker", |
293 "Python does not support the unary prefix increment", |
293 "Python does not support the unary prefix increment", |
359 "(if using 'assertRaises'), or add the 'match' keyword argument (if " |
359 "(if using 'assertRaises'), or add the 'match' keyword argument (if " |
360 "using 'pytest.raises'), or use the context manager form with a target.", |
360 "using 'pytest.raises'), or use the context manager form with a target.", |
361 ), |
361 ), |
362 "M518": QCoreApplication.translate( |
362 "M518": QCoreApplication.translate( |
363 "MiscellaneousChecker", |
363 "MiscellaneousChecker", |
364 "Found useless expression. Consider either assigning it to a variable or" |
364 "Found useless {0} expression. Consider either assigning it to a variable or" |
365 " removing it.", |
365 " removing it.", |
366 ), |
366 ), |
367 "M519": QCoreApplication.translate( |
367 "M519": QCoreApplication.translate( |
368 "MiscellaneousChecker", |
368 "MiscellaneousChecker", |
369 "Use of 'functools.lru_cache' or 'functools.cache' on methods can lead to" |
369 "Use of 'functools.lru_cache' or 'functools.cache' on methods can lead to" |
452 " confusion due to unintuitive argument positions.", |
452 " confusion due to unintuitive argument positions.", |
453 ), |
453 ), |
454 "M535": QCoreApplication.translate( |
454 "M535": QCoreApplication.translate( |
455 "MiscellaneousChecker", |
455 "MiscellaneousChecker", |
456 "Static key in dict comprehension: {0!r}.", |
456 "Static key in dict comprehension: {0!r}.", |
|
457 ), |
|
458 "M536": QCoreApplication.translate( |
|
459 "MiscellaneousChecker", |
|
460 "Don't except 'BaseException' unless you plan to re-raise it.", |
|
461 ), |
|
462 "M537": QCoreApplication.translate( |
|
463 "MiscellaneousChecker", |
|
464 "Class '__init__' methods must not return or yield and any values.", |
|
465 ), |
|
466 "M538": QCoreApplication.translate( |
|
467 "MiscellaneousChecker", |
|
468 "Editing a loop's mutable iterable often leads to unexpected results/bugs.", |
457 ), |
469 ), |
458 ## Bugbear++ |
470 ## Bugbear++ |
459 "M581": QCoreApplication.translate( |
471 "M581": QCoreApplication.translate( |
460 "MiscellaneousChecker", |
472 "MiscellaneousChecker", |
461 "unncessary f-string", |
473 "unncessary f-string", |