344 "do not call assert False since python -O removes these calls", |
344 "do not call assert False since python -O removes these calls", |
345 ), |
345 ), |
346 "M512": QCoreApplication.translate( |
346 "M512": QCoreApplication.translate( |
347 "MiscellaneousChecker", |
347 "MiscellaneousChecker", |
348 "return/continue/break inside finally blocks cause exceptions to be silenced." |
348 "return/continue/break inside finally blocks cause exceptions to be silenced." |
349 " Exceptions should be silenced in except blocks. Control statements can be" |
349 " Exceptions should be silenced in except{0} blocks. Control statements can be" |
350 " moved outside the finally block.", |
350 " moved outside the finally block.", |
351 ), |
351 ), |
352 "M513": QCoreApplication.translate( |
352 "M513": QCoreApplication.translate( |
353 "MiscellaneousChecker", |
353 "MiscellaneousChecker", |
354 "A length-one tuple literal is redundant. Write 'except {0}:' instead of" |
354 "A length-one tuple literal is redundant. Write 'except{1} {0}:' instead of" |
355 " 'except ({0},):'.", |
355 " 'except{1} ({0},):'.", |
356 ), |
356 ), |
357 "M514": QCoreApplication.translate( |
357 "M514": QCoreApplication.translate( |
358 "MiscellaneousChecker", |
358 "MiscellaneousChecker", |
359 "Redundant exception types in 'except ({0}){1}:'. Write 'except {2}{1}:'," |
359 "Redundant exception types in 'except{3} ({0}){1}:'. Write 'except{3} {2}{1}:'," |
360 " which catches exactly the same exceptions.", |
360 " which catches exactly the same exceptions.", |
361 ), |
361 ), |
362 "M515": QCoreApplication.translate( |
362 "M515": QCoreApplication.translate( |
363 "MiscellaneousChecker", |
363 "MiscellaneousChecker", |
364 "Result of comparison is not used. This line doesn't do anything. Did you" |
364 "Result of comparison is not used. This line doesn't do anything. Did you" |
414 " add the @abstractmethod decorator, potentially in conjunction with" |
414 " add the @abstractmethod decorator, potentially in conjunction with" |
415 " @classmethod, @property and/or @staticmethod.", |
415 " @classmethod, @property and/or @staticmethod.", |
416 ), |
416 ), |
417 "M525": QCoreApplication.translate( |
417 "M525": QCoreApplication.translate( |
418 "MiscellaneousChecker", |
418 "MiscellaneousChecker", |
419 "Exception '{0}' has been caught multiple times. Only the first except will be" |
419 "Exception '{0}' has been caught multiple times. Only the first except{1} will" |
420 " considered and all other except catches can be safely removed.", |
420 " be considered and all other except{1} catches can be safely removed.", |
421 ), |
421 ), |
422 "M526": QCoreApplication.translate( |
422 "M526": QCoreApplication.translate( |
423 "MiscellaneousChecker", |
423 "MiscellaneousChecker", |
424 "Star-arg unpacking after a keyword argument is strongly discouraged," |
424 "Star-arg unpacking after a keyword argument is strongly discouraged," |
425 " because it only works when the keyword parameter is declared after all" |
425 " because it only works when the keyword parameter is declared after all" |
439 " It is therefore recommended to use a stacklevel of 2 or" |
439 " It is therefore recommended to use a stacklevel of 2 or" |
440 " greater to provide more information to the user.", |
440 " greater to provide more information to the user.", |
441 ), |
441 ), |
442 "M529": QCoreApplication.translate( |
442 "M529": QCoreApplication.translate( |
443 "MiscellaneousChecker", |
443 "MiscellaneousChecker", |
444 "Using 'except ():' with an empty tuple does not handle/catch " |
444 "Using 'except{0} ():' with an empty tuple does not handle/catch " |
445 "anything. Add exceptions to handle.", |
445 "anything. Add exceptions to handle.", |
446 ), |
446 ), |
447 "M530": QCoreApplication.translate( |
447 "M530": QCoreApplication.translate( |
448 "MiscellaneousChecker", |
448 "MiscellaneousChecker", |
449 "Except handlers should only be names of exception classes", |
449 "Except handlers should only be names of exception classes", |
477 "MiscellaneousChecker", |
477 "MiscellaneousChecker", |
478 "Don't except 'BaseException' unless you plan to re-raise it.", |
478 "Don't except 'BaseException' unless you plan to re-raise it.", |
479 ), |
479 ), |
480 "M537": QCoreApplication.translate( |
480 "M537": QCoreApplication.translate( |
481 "MiscellaneousChecker", |
481 "MiscellaneousChecker", |
482 "Class '__init__' methods must not return or yield and any values.", |
482 "Class '__init__' methods must not return or yield any values.", |
483 ), |
483 ), |
484 "M539": QCoreApplication.translate( |
484 "M539": QCoreApplication.translate( |
485 "MiscellaneousChecker", |
485 "MiscellaneousChecker", |
486 "ContextVar with mutable literal or function call as default. This is only" |
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" |
487 " evaluated once, and all subsequent calls to `.get()` will return the same" |
488 " instance of the default.", |
488 " instance of the default.", |
489 ), |
489 ), |
490 "M540": QCoreApplication.translate( |
490 "M540": QCoreApplication.translate( |
491 "MiscellaneousChecker", |
491 "MiscellaneousChecker", |
492 "Exception with added note not used. Did you forget to raise it?", |
492 "Exception with added note not used. Did you forget to raise it?", |
|
493 ), |
|
494 "M541": QCoreApplication.translate( |
|
495 "MiscellaneousChecker", |
|
496 "Repeated key-value pair in dictionary literal.", |
493 ), |
497 ), |
494 ## Bugbear, opininonated |
498 ## Bugbear, opininonated |
495 "M569": QCoreApplication.translate( |
499 "M569": QCoreApplication.translate( |
496 "MiscellaneousChecker", |
500 "MiscellaneousChecker", |
497 "Editing a loop's mutable iterable often leads to unexpected results/bugs.", |
501 "Editing a loop's mutable iterable often leads to unexpected results/bugs.", |
669 "M265": ["foo", "bar"], |
673 "M265": ["foo", "bar"], |
670 "M266": ["foo", "bar"], |
674 "M266": ["foo", "bar"], |
671 "M267": ["foo"], |
675 "M267": ["foo"], |
672 ## Bugbear |
676 ## Bugbear |
673 "M507": ["x"], |
677 "M507": ["x"], |
674 "M513": ["Exception"], |
678 "M512": [""], |
675 "M514": ["OSError, IOError", " as err", "OSError"], |
679 "M513": ["Exception", ""], |
|
680 "M514": ["OSError, IOError", " as err", "OSError", ""], |
676 "M518": ["List"], |
681 "M518": ["List"], |
677 "M523": ["x"], |
682 "M523": ["x"], |
678 "M524": ["foobar"], |
683 "M524": ["foobar"], |
679 "M525": ["OSError"], |
684 "M525": ["OSError", ""], |
680 "M527": ["foo"], |
685 "M527": ["foo"], |
|
686 "M529": [""], |
681 "M533": ["foo"], |
687 "M533": ["foo"], |
682 "M534": ["split", "maxsplit"], |
688 "M534": ["split", "maxsplit"], |
683 "M535": ["foo"], |
689 "M535": ["foo"], |
684 ## Format Strings |
690 ## Format Strings |
685 "M601": ["%s"], |
691 "M601": ["%s"], |