310 "MiscellaneousChecker", |
310 "MiscellaneousChecker", |
311 "using .strip() with multi-character strings is misleading. Use .replace()," |
311 "using .strip() with multi-character strings is misleading. Use .replace()," |
312 " .removeprefix(), .removesuffix(), or regular expressions to remove string" |
312 " .removeprefix(), .removesuffix(), or regular expressions to remove string" |
313 " fragments.", |
313 " fragments.", |
314 ), |
314 ), |
|
315 "M506": QCoreApplication.translate( |
|
316 "MiscellaneousChecker", |
|
317 "Do not use mutable data structures for argument defaults. They are created" |
|
318 " during function definition time. All calls to the function reuse this one" |
|
319 " instance of that data structure, persisting changes between them." |
|
320 ), |
315 "M507": QCoreApplication.translate( |
321 "M507": QCoreApplication.translate( |
316 "MiscellaneousChecker", |
322 "MiscellaneousChecker", |
317 "loop control variable {0} not used within the loop body -" |
323 "loop control variable {0} not used within the loop body -" |
318 " start the name with an underscore", |
324 " start the name with an underscore", |
|
325 ), |
|
326 "M508": QCoreApplication.translate( |
|
327 "MiscellaneousChecker", |
|
328 "Do not perform function calls in argument defaults. The call is performed" |
|
329 " only once at function definition time. All calls to your function will reuse" |
|
330 " the result of that definition-time function call. If this is intended," |
|
331 " assign the function call to a module-level variable and use that variable as" |
|
332 " a default value." |
319 ), |
333 ), |
320 "M509": QCoreApplication.translate( |
334 "M509": QCoreApplication.translate( |
321 "MiscellaneousChecker", |
335 "MiscellaneousChecker", |
322 "do not call getattr with a constant attribute value", |
336 "do not call getattr with a constant attribute value", |
323 ), |
337 ), |
464 "Don't except 'BaseException' unless you plan to re-raise it.", |
478 "Don't except 'BaseException' unless you plan to re-raise it.", |
465 ), |
479 ), |
466 "M537": QCoreApplication.translate( |
480 "M537": QCoreApplication.translate( |
467 "MiscellaneousChecker", |
481 "MiscellaneousChecker", |
468 "Class '__init__' methods must not return or yield and any values.", |
482 "Class '__init__' methods must not return or yield and any values.", |
|
483 ), |
|
484 "M539": QCoreApplication.translate( |
|
485 "MiscellaneousChecker", |
|
486 "ContextVar with mutable literal or function call as default. This is only" |
|
487 " evaluated once, and all subsequent calls to `.get()` will return the same" |
|
488 " instance of the default.", |
|
489 ), |
|
490 "M540": QCoreApplication.translate( |
|
491 "MiscellaneousChecker", |
|
492 "Exception with added note not used. Did you forget to raise it?", |
469 ), |
493 ), |
470 ## Bugbear, opininonated |
494 ## Bugbear, opininonated |
471 "M569": QCoreApplication.translate( |
495 "M569": QCoreApplication.translate( |
472 "MiscellaneousChecker", |
496 "MiscellaneousChecker", |
473 "Editing a loop's mutable iterable often leads to unexpected results/bugs.", |
497 "Editing a loop's mutable iterable often leads to unexpected results/bugs.", |