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

branch
eric7
changeset 10999
c3cf24fe9113
parent 10907
c424150d2ac8
child 11000
f8371a2dd08f
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/translations.py	Tue Oct 22 16:50:36 2024 +0200
+++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/translations.py	Tue Oct 22 17:22:53 2024 +0200
@@ -312,11 +312,25 @@
         " .removeprefix(), .removesuffix(), or regular expressions to remove string"
         " fragments.",
     ),
+    "M506": QCoreApplication.translate(
+        "MiscellaneousChecker",
+        "Do not use mutable data structures for argument defaults. They are created"
+        " during function definition time. All calls to the function reuse this one"
+        " instance of that data structure, persisting changes between them."
+    ),
     "M507": QCoreApplication.translate(
         "MiscellaneousChecker",
         "loop control variable {0} not used within the loop body -"
         " start the name with an underscore",
     ),
+    "M508": QCoreApplication.translate(
+        "MiscellaneousChecker",
+        "Do not perform function calls in argument defaults. The call is performed"
+        " only once at function definition time. All calls to your function will reuse"
+        " the result of that definition-time function call.  If this is intended,"
+        " assign the function call to a module-level variable and use that variable as"
+        " a default value."
+    ),
     "M509": QCoreApplication.translate(
         "MiscellaneousChecker",
         "do not call getattr with a constant attribute value",
@@ -467,6 +481,16 @@
         "MiscellaneousChecker",
         "Class '__init__' methods must not return or yield and any values.",
     ),
+    "M539": QCoreApplication.translate(
+        "MiscellaneousChecker",
+        "ContextVar with mutable literal or function call as default. This is only"
+        " evaluated once, and all subsequent calls to `.get()` will return the same"
+        " instance of the default.",
+    ),
+    "M540": QCoreApplication.translate(
+        "MiscellaneousChecker",
+        "Exception with added note not used. Did you forget to raise it?",
+    ),
     ## Bugbear, opininonated
     "M569": QCoreApplication.translate(
         "MiscellaneousChecker",

eric ide

mercurial