--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/translations.py Mon May 29 16:18:38 2023 +0200 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/translations.py Tue May 30 17:25:17 2023 +0200 @@ -12,18 +12,21 @@ from PyQt6.QtCore import QCoreApplication _miscellaneousMessages = { + ## Coding line "M101": QCoreApplication.translate( "MiscellaneousChecker", "coding magic comment not found" ), "M102": QCoreApplication.translate( "MiscellaneousChecker", "unknown encoding ({0}) found in coding magic comment" ), + ## Copyright "M111": QCoreApplication.translate( "MiscellaneousChecker", "copyright notice not present" ), "M112": QCoreApplication.translate( "MiscellaneousChecker", "copyright notice contains invalid author" ), + ## Shadowed Builtins "M131": QCoreApplication.translate( "MiscellaneousChecker", '"{0}" is a Python builtin and is being shadowed; ' @@ -34,6 +37,7 @@ '"{0}" is used as an argument and thus shadows a ' "Python builtin; consider renaming the argument", ), + ## Comprehensions "M181": QCoreApplication.translate( "MiscellaneousChecker", "unnecessary generator - rewrite as a list comprehension", @@ -100,9 +104,47 @@ "MiscellaneousChecker", "unnecessary {0} passed to list() - remove the outer call to {1}()", ), + ## Dictionaries with sorted keys "M201": QCoreApplication.translate( "MiscellaneousChecker", "sort keys - '{0}' should be before '{1}'" ), + ## Property + "M210": QCoreApplication.translate( + "MiscellaneousChecker", + "the number of arguments for property getter method is wrong" + " (should be 1 instead of {0})", + ), + "M211": QCoreApplication.translate( + "MiscellaneousChecker", + "the number of arguments for property setter method is wrong" + " (should be 2 instead of {0})", + ), + "M212": QCoreApplication.translate( + "MiscellaneousChecker", + "the number of arguments for property deleter method is wrong" + " (should be 1 instead of {0})", + ), + "M213": QCoreApplication.translate( + "MiscellaneousChecker", + "the name of the setter method is wrong (should be '{0}' instead of '{1}'", + ), + "M214": QCoreApplication.translate( + "MiscellaneousChecker", + "the name of the deleter method is wrong (should be '{0}' instead of '{1}'", + ), + "M215": QCoreApplication.translate( + "MiscellaneousChecker", + "the name of the setter decorator is wrong (should be '{0}' instead of '{1}'", + ), + "M216": QCoreApplication.translate( + "MiscellaneousChecker", + "the name of the deleter decorator is wrong (should be '{0}' instead of '{1}'", + ), + "M217": QCoreApplication.translate( + "MiscellaneousChecker", + "multiple decorators were used to declare property '{0}'", + ), + ## Naive datetime usage "M301": QCoreApplication.translate( "MiscellaneousChecker", "use of 'datetime.datetime()' without 'tzinfo' argument should be avoided", @@ -166,6 +208,7 @@ "MiscellaneousChecker", "use of 'datetime.time()' without 'tzinfo' argument should be avoided", ), + ## sys.version and sys.version_info usage "M401": QCoreApplication.translate( "MiscellaneousChecker", "'sys.version[:3]' referenced (Python 3.10), use 'sys.version_info'", @@ -207,6 +250,7 @@ "MiscellaneousChecker", "'sys.version[:1]' referenced (Python 10), use 'sys.version_info'", ), + ## Bugbear "M501": QCoreApplication.translate( "MiscellaneousChecker", "Do not use bare 'except:', it also catches unexpected events like memory" @@ -369,11 +413,13 @@ "Sets should not contain duplicate items. Duplicate items will be replaced" " with a single item at runtime.", ), + ## Bugbear++ "M581": QCoreApplication.translate("MiscellaneousChecker", "unncessary f-string"), "M582": QCoreApplication.translate( "MiscellaneousChecker", "cannot use 'self.__class__' as first argument of 'super()' call", ), + ## Format Strings "M601": QCoreApplication.translate("MiscellaneousChecker", "found {0} formatter"), "M611": QCoreApplication.translate( "MiscellaneousChecker", "format string does contain unindexed parameters" @@ -408,6 +454,7 @@ "M632": QCoreApplication.translate( "MiscellaneousChecker", "format call provides unused keyword ({0})" ), + ## Logging "M651": QCoreApplication.translate( "MiscellaneousChecker", "logging statement uses string.format()" ), @@ -423,6 +470,7 @@ "M655": QCoreApplication.translate( "MiscellaneousChecker", "logging statement uses 'warn' instead of 'warning'" ), + ## Future statements "M701": QCoreApplication.translate( "MiscellaneousChecker", "expected these __future__ imports: {0}; but only got: {1}", @@ -430,13 +478,17 @@ "M702": QCoreApplication.translate( "MiscellaneousChecker", "expected these __future__ imports: {0}; but got none" ), + ## Gettext "M711": QCoreApplication.translate( "MiscellaneousChecker", "gettext import with alias _ found: {0}" ), + ##~ print() statements "M801": QCoreApplication.translate("MiscellaneousChecker", "print statement found"), + ## one element tuple "M811": QCoreApplication.translate( "MiscellaneousChecker", "one element tuple found" ), + ## Mutable Defaults "M821": QCoreApplication.translate( "MiscellaneousChecker", "mutable default argument of type {0}" ), @@ -446,6 +498,7 @@ "M823": QCoreApplication.translate( "MiscellaneousChecker", "mutable default argument of function call '{0}'" ), + ##~ return statements "M831": QCoreApplication.translate( "MiscellaneousChecker", "None should not be added at any return if function has no return" @@ -466,11 +519,13 @@ "a value should not be assigned to a variable if it will be used as a" " return value only", ), + ## line continuation "M841": QCoreApplication.translate( "MiscellaneousChecker", "prefer implied line continuation inside parentheses, " "brackets and braces as opposed to a backslash", ), + ## commented code "M891": QCoreApplication.translate( "MiscellaneousChecker", "commented code lines should be removed" ), @@ -493,6 +548,14 @@ "M197": ["tuple", "tuple"], "M198": ["list", "list"], "M201": ["bar", "foo"], + "M210": [2], + "M211": [1], + "M212": [2], + "M213": ["foo", "bar"], + "M214": ["foo", "bar"], + "M215": ["foo", "bar"], + "M216": ["foo", "bar"], + "M217": ["foo"], "M507": ["x"], "M513": ["Exception"], "M514": ["OSError, IOError", " as err", "OSError"],