src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/translations.py

branch
eric7
changeset 10048
df836ff707fd
parent 9653
e67609152c5e
child 10050
3750abc45d5e
diff -r cc9ead6d1c46 -r df836ff707fd src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/translations.py
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/translations.py	Sun May 21 16:04:59 2023 +0200
+++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/translations.py	Mon May 22 08:43:23 2023 +0200
@@ -209,8 +209,10 @@
     ),
     "M501": QCoreApplication.translate(
         "MiscellaneousChecker",
-        "Do not use 'except (){0}:', it also catches unexpected events. Prefer"
-        " 'except Exception:'.",
+        "Do not use bare 'except:', it also catches unexpected events like memory"
+        " errors, interrupts, system exit, and so on. Prefer 'except Exception:'."
+        " If you're sure what you're doing, be explicit and write"
+        " 'except BaseException:'.",
     ),
     "M502": QCoreApplication.translate(
         "MiscellaneousChecker", "Python does not support the unary prefix increment"
@@ -227,8 +229,9 @@
     ),
     "M505": QCoreApplication.translate(
         "MiscellaneousChecker",
-        "using .strip() with multi-character strings is misleading. Use "
-        ".replace() or regular expressions to remove string fragments.",
+        "using .strip() with multi-character strings is misleading. Use .replace(),"
+        " .removeprefix(), .removesuffix(), or regular expressions to remove string"
+        " fragments.",
     ),
     "M507": QCoreApplication.translate(
         "MiscellaneousChecker",
@@ -272,10 +275,12 @@
     ),
     "M517": QCoreApplication.translate(
         "MiscellaneousChecker",
-        "'assertRaises(Exception):' should be considered evil. It can lead to your test"
-        " passing even if the code being tested is never executed due to a typo. Either"
-        " assert for a more specific exception (builtin or custom), use"
-        " 'assertRaisesRegex', or use the context manager form of 'assertRaises'.",
+        "'assertRaises(Exception)' and 'pytest.raises(Exception)' should "
+        "be considered evil. They can lead to your test passing even if the "
+        "code being tested is never executed due to a typo. Assert for a more "
+        "specific exception (builtin or custom), or use 'assertRaisesRegex' "
+        "(if using 'assertRaises'), or add the 'match' keyword argument (if "
+        "using 'pytest.raises'), or use the context manager form with a target.",
     ),
     "M518": QCoreApplication.translate(
         "MiscellaneousChecker",
@@ -309,8 +314,9 @@
     ),
     "M524": QCoreApplication.translate(
         "MiscellaneousChecker",
-        "{0} is an abstract base class, but it has no abstract methods. Remember to"
-        " use the @abstractmethod decorator, potentially in conjunction with"
+        "{0} is an abstract base class, but none of the methods it defines are"
+        " abstract. This is not necessarily an error, but you might have forgotten to"
+        " add the @abstractmethod decorator, potentially in conjunction with"
         " @classmethod, @property and/or @staticmethod.",
     ),
     "M525": QCoreApplication.translate(
@@ -330,6 +336,39 @@
         "{0} is an empty method in an abstract base class, but has no abstract"
         " decorator. Consider adding @abstractmethod.",
     ),
+    "M528": QCoreApplication.translate(
+        "MiscellaneousChecker",
+        "No explicit stacklevel argument found. The warn method from the"
+        " warnings module uses a stacklevel of 1 by default. This will only show a"
+        " stack trace for the line on which the warn method is called."
+        " It is therefore recommended to use a stacklevel of 2 or"
+        " greater to provide more information to the user.",
+    ),
+    "M529":QCoreApplication.translate(
+        "MiscellaneousChecker",
+        "Using 'except ():' with an empty tuple does not handle/catch "
+        "anything. Add exceptions to handle.",
+    ), 
+    "M530":QCoreApplication.translate(
+        "MiscellaneousChecker",
+        "Except handlers should only be names of exception classes",
+    ), 
+    "M531":QCoreApplication.translate(
+        "MiscellaneousChecker",
+        "Using the generator returned from 'itertools.groupby()' more than once"
+        " will do nothing on the second usage. Save the result to a list, if the"
+        " result is needed multiple times.",
+    ), 
+    "M532":QCoreApplication.translate(
+        "MiscellaneousChecker",
+        "Possible unintentional type annotation (using ':'). Did you mean to"
+        " assign (using '=')?",
+    ),
+    "M533":QCoreApplication.translate(
+        "MiscellaneousChecker",
+        "Sets should not contain duplicate items. Duplicate items will be replaced"
+        " with a single item at runtime.",
+    ),
     "M581": QCoreApplication.translate("MiscellaneousChecker", "unncessary f-string"),
     "M582": QCoreApplication.translate(
         "MiscellaneousChecker",
@@ -454,7 +493,6 @@
     "M197": ["tuple", "tuple"],
     "M198": ["list", "list"],
     "M201": ["bar", "foo"],
-    "M501": [" as err"],
     "M507": ["x"],
     "M513": ["Exception"],
     "M514": ["OSError, IOError", " as err", "OSError"],

eric ide

mercurial