--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/translations.py Wed Nov 29 14:49:44 2023 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/translations.py Wed Nov 29 18:07:53 2023 +0100 @@ -14,17 +14,21 @@ _miscellaneousMessages = { ## Coding line "M101": QCoreApplication.translate( - "MiscellaneousChecker", "coding magic comment not found" + "MiscellaneousChecker", + "coding magic comment not found", ), "M102": QCoreApplication.translate( - "MiscellaneousChecker", "unknown encoding ({0}) found in coding magic comment" + "MiscellaneousChecker", + "unknown encoding ({0}) found in coding magic comment", ), ## Copyright "M111": QCoreApplication.translate( - "MiscellaneousChecker", "copyright notice not present" + "MiscellaneousChecker", + "copyright notice not present", ), "M112": QCoreApplication.translate( - "MiscellaneousChecker", "copyright notice contains invalid author" + "MiscellaneousChecker", + "copyright notice contains invalid author", ), ## Shadowed Builtins "M131": QCoreApplication.translate( @@ -38,75 +42,104 @@ "Python builtin; consider renaming the argument", ), ## Comprehensions - "M181": QCoreApplication.translate( + "M180": QCoreApplication.translate( "MiscellaneousChecker", "unnecessary generator - rewrite as a list comprehension", ), + "M181": QCoreApplication.translate( + "MiscellaneousChecker", + "unnecessary generator - rewrite as a set comprehension", + ), "M182": QCoreApplication.translate( - "MiscellaneousChecker", "unnecessary generator - rewrite as a set comprehension" - ), - "M183": QCoreApplication.translate( "MiscellaneousChecker", "unnecessary generator - rewrite as a dict comprehension", ), + "M183": QCoreApplication.translate( + "MiscellaneousChecker", + "unnecessary list comprehension - rewrite as a set comprehension", + ), "M184": QCoreApplication.translate( "MiscellaneousChecker", - "unnecessary list comprehension - rewrite as a set comprehension", + "unnecessary list comprehension - rewrite as a dict comprehension", ), "M185": QCoreApplication.translate( "MiscellaneousChecker", - "unnecessary list comprehension - rewrite as a dict comprehension", + "unnecessary {0} literal - rewrite as a {1} literal", ), "M186": QCoreApplication.translate( - "MiscellaneousChecker", "unnecessary {0} call - rewrite as a literal" + "MiscellaneousChecker", + "unnecessary {0} literal - rewrite as a {1} literal", + ), + "M188": QCoreApplication.translate( + "MiscellaneousChecker", + "unnecessary {0} call - rewrite as a literal", + ), + "M189a": QCoreApplication.translate( + "MiscellaneousChecker", + "unnecessary {0} passed to tuple() - remove the outer call to {1}()", ), - "M187a": QCoreApplication.translate( + "M189b": QCoreApplication.translate( + "MiscellaneousChecker", + "unnecessary {0} passed to tuple() - rewrite as a {1} literal", + ), + "M190a": QCoreApplication.translate( + "MiscellaneousChecker", + "unnecessary {0} passed to list() - remove the outer call to {1}()", + ), + "M190b": QCoreApplication.translate( + "MiscellaneousChecker", + "unnecessary {0} passed to list() - rewrite as a {1} literal", + ), + "M191": QCoreApplication.translate( + "MiscellaneousChecker", + "unnecessary list call - remove the outer call to list()", + ), + "M193a": QCoreApplication.translate( "MiscellaneousChecker", "unnecessary {0} call around {1}() - toggle reverse argument to sorted()", ), - "M187b": QCoreApplication.translate( + "M193b": QCoreApplication.translate( "MiscellaneousChecker", - "unnecessary {0} call around {1}() - use sorted(..., reverse={2})", + "unnecessary {0} call around {1}() - use sorted(..., reverse={2!r})", ), - "M187c": QCoreApplication.translate( - "MiscellaneousChecker", "unnecessary {0} call around {1}()" + "M193c": QCoreApplication.translate( + "MiscellaneousChecker", + "unnecessary {0} call around {1}()", ), - "M188": QCoreApplication.translate( - "MiscellaneousChecker", "unnecessary {0} call within {1}()" + "M194": QCoreApplication.translate( + "MiscellaneousChecker", + "unnecessary {0} call within {1}()", ), - "M189": QCoreApplication.translate( + "M195": QCoreApplication.translate( "MiscellaneousChecker", "unnecessary subscript reversal of iterable within {0}()", ), - "M191": QCoreApplication.translate( - "MiscellaneousChecker", "unnecessary {0} literal - rewrite as a {1} literal" - ), - "M192": QCoreApplication.translate( - "MiscellaneousChecker", - "unnecessary {0} passed to tuple() - rewrite as a {1} literal", - ), - "M193": QCoreApplication.translate( + "M196": QCoreApplication.translate( "MiscellaneousChecker", - "unnecessary {0} passed to list() - rewrite as a {1} literal", - ), - "M195": QCoreApplication.translate( - "MiscellaneousChecker", - "unnecessary list call - remove the outer call to list()", - ), - "M196": QCoreApplication.translate( - "MiscellaneousChecker", "unnecessary {0} comprehension - rewrite using {0}()" + "unnecessary {0} comprehension - rewrite using {0}()", ), "M197": QCoreApplication.translate( "MiscellaneousChecker", - "unnecessary {0} passed to tuple() - remove the outer call to {1}()", + "Unnecessary use of map - use a {0} instead", + ), "M198": QCoreApplication.translate( "MiscellaneousChecker", - "unnecessary {0} passed to list() - remove the outer call to {1}()", + "Unnecessary {0} passed to dict() - remove the outer call to dict()" ), + "M199": QCoreApplication.translate( + "MiscellaneousChecker", + "Unnecessary list comprehension passed to {0}() prevents short-circuiting" + " - rewrite as a generator" + ), + + + + ## Dictionaries with sorted keys "M201": QCoreApplication.translate( - "MiscellaneousChecker", "sort keys - '{0}' should be before '{1}'" + "MiscellaneousChecker", + "sort keys - '{0}' should be before '{1}'", ), ## Property "M210": QCoreApplication.translate( @@ -198,7 +231,8 @@ "Use 'datetime.datetime.fromtimestamp(tz=).date()' instead.", ), "M314": QCoreApplication.translate( - "MiscellaneousChecker", "use of 'datetime.date.fromordinal()' should be avoided" + "MiscellaneousChecker", + "use of 'datetime.date.fromordinal()' should be avoided", ), "M315": QCoreApplication.translate( "MiscellaneousChecker", @@ -226,7 +260,8 @@ "'sys.version_info[0] == 3' referenced (Python 4), use '>='", ), "M412": QCoreApplication.translate( - "MiscellaneousChecker", "'six.PY3' referenced (Python 4), use 'not six.PY2'" + "MiscellaneousChecker", + "'six.PY3' referenced (Python 4), use 'not six.PY2'", ), "M413": QCoreApplication.translate( "MiscellaneousChecker", @@ -259,7 +294,8 @@ " 'except BaseException:'.", ), "M502": QCoreApplication.translate( - "MiscellaneousChecker", "Python does not support the unary prefix increment" + "MiscellaneousChecker", + "Python does not support the unary prefix increment", ), "M503": QCoreApplication.translate( "MiscellaneousChecker", @@ -283,10 +319,12 @@ " start the name with an underscore", ), "M509": QCoreApplication.translate( - "MiscellaneousChecker", "do not call getattr with a constant attribute value" + "MiscellaneousChecker", + "do not call getattr with a constant attribute value", ), "M510": QCoreApplication.translate( - "MiscellaneousChecker", "do not call setattr with a constant attribute value" + "MiscellaneousChecker", + "do not call setattr with a constant attribute value", ), "M511": QCoreApplication.translate( "MiscellaneousChecker", @@ -423,27 +461,38 @@ "Static key in dict comprehension: {0!r}.", ), ## Bugbear++ - "M581": QCoreApplication.translate("MiscellaneousChecker", "unncessary f-string"), + "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"), + "M601": QCoreApplication.translate( + "MiscellaneousChecker", + "found {0} formatter", + ), "M611": QCoreApplication.translate( - "MiscellaneousChecker", "format string does contain unindexed parameters" + "MiscellaneousChecker", + "format string does contain unindexed parameters", ), "M612": QCoreApplication.translate( - "MiscellaneousChecker", "docstring does contain unindexed parameters" + "MiscellaneousChecker", + "docstring does contain unindexed parameters", ), "M613": QCoreApplication.translate( - "MiscellaneousChecker", "other string does contain unindexed parameters" + "MiscellaneousChecker", + "other string does contain unindexed parameters", ), "M621": QCoreApplication.translate( - "MiscellaneousChecker", "format call uses too large index ({0})" + "MiscellaneousChecker", + "format call uses too large index ({0})", ), "M622": QCoreApplication.translate( - "MiscellaneousChecker", "format call uses missing keyword ({0})" + "MiscellaneousChecker", + "format call uses missing keyword ({0})", ), "M623": QCoreApplication.translate( "MiscellaneousChecker", @@ -458,26 +507,33 @@ "format call uses implicit and explicit indexes together", ), "M631": QCoreApplication.translate( - "MiscellaneousChecker", "format call provides unused index ({0})" + "MiscellaneousChecker", + "format call provides unused index ({0})", ), "M632": QCoreApplication.translate( - "MiscellaneousChecker", "format call provides unused keyword ({0})" + "MiscellaneousChecker", + "format call provides unused keyword ({0})", ), ## Logging "M651": QCoreApplication.translate( - "MiscellaneousChecker", "logging statement uses string.format()" + "MiscellaneousChecker", + "logging statement uses string.format()", ), "M652": QCoreApplication.translate( - "MiscellaneousChecker", "logging statement uses '%'" # __IGNORE_WARNING_M601__ + "MiscellaneousChecker", + "logging statement uses '%'", # __IGNORE_WARNING_M601__ ), "M653": QCoreApplication.translate( - "MiscellaneousChecker", "logging statement uses '+'" + "MiscellaneousChecker", + "logging statement uses '+'", ), "M654": QCoreApplication.translate( - "MiscellaneousChecker", "logging statement uses f-string" + "MiscellaneousChecker", + "logging statement uses f-string", ), "M655": QCoreApplication.translate( - "MiscellaneousChecker", "logging statement uses 'warn' instead of 'warning'" + "MiscellaneousChecker", + "logging statement uses 'warn' instead of 'warning'", ), ## Future statements "M701": QCoreApplication.translate( @@ -485,27 +541,36 @@ "expected these __future__ imports: {0}; but only got: {1}", ), "M702": QCoreApplication.translate( - "MiscellaneousChecker", "expected these __future__ imports: {0}; but got none" + "MiscellaneousChecker", + "expected these __future__ imports: {0}; but got none", ), ## Gettext "M711": QCoreApplication.translate( - "MiscellaneousChecker", "gettext import with alias _ found: {0}" + "MiscellaneousChecker", + "gettext import with alias _ found: {0}", ), ##~ print() statements - "M801": QCoreApplication.translate("MiscellaneousChecker", "print statement found"), + "M801": QCoreApplication.translate( + "MiscellaneousChecker", + "print statement found", + ), ## one element tuple "M811": QCoreApplication.translate( - "MiscellaneousChecker", "one element tuple found" + "MiscellaneousChecker", + "one element tuple found", ), ## Mutable Defaults "M821": QCoreApplication.translate( - "MiscellaneousChecker", "mutable default argument of type {0}" + "MiscellaneousChecker", + "mutable default argument of type {0}", ), "M822": QCoreApplication.translate( - "MiscellaneousChecker", "mutable default argument of type {0}" + "MiscellaneousChecker", + "mutable default argument of type {0}", ), "M823": QCoreApplication.translate( - "MiscellaneousChecker", "mutable default argument of function call '{0}'" + "MiscellaneousChecker", + "mutable default argument of function call '{0}'", ), ##~ return statements "M831": QCoreApplication.translate( @@ -536,7 +601,8 @@ ), ## commented code "M891": QCoreApplication.translate( - "MiscellaneousChecker", "commented code lines should be removed" + "MiscellaneousChecker", + "commented code lines should be removed", ), } @@ -544,18 +610,22 @@ "M102": ["enc42"], "M131": ["list"], "M132": ["list"], - "M186": ["list"], - "M187a": ["reversed", "sorted"], - "M187b": ["reversed", "sorted", "True"], - "M187c": ["list", "sorted"], - "M188": ["sorted", "list"], - "M189": ["sorted"], - "M191": ["list", "set"], - "M192": ["list", "tuple"], - "M193": ["tuple", "list"], + "M185": ["list", "set"], + "M186": ["list", "dict"], + "M188": ["list"], + "M189a": ["tuple", "tuple"], + "M189b": ["list", "tuple"], + "M190a": ["list", "list"], + "M190b": ["tuple", "list"], + "M193a": ["reversed", "sorted"], + "M193b": ["reversed", "sorted", "True"], + "M193c": ["list", "sorted"], + "M194": ["list", "sorted"], + "M195": ["sorted"], "M196": ["list"], - "M197": ["tuple", "tuple"], - "M198": ["list", "list"], + "M197": ["list"], + "M198": ["dict comprehension"], + "M199": ["any"], "M201": ["bar", "foo"], "M210": [2], "M211": [1],