diff -r b925628bf91f -r db7f2badd374 eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/translations.py --- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/translations.py Sat Apr 03 10:44:07 2021 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/translations.py Sat Apr 03 14:51:08 2021 +0200 @@ -12,6 +12,7 @@ from PyQt5.QtCore import QCoreApplication _simplifyMessages = { + # Python-specifics "Y101": QCoreApplication.translate( "SimplifyChecker", '''Multiple "isinstance()" calls which can be merged into a single ''' @@ -75,9 +76,63 @@ "Y120": QCoreApplication.translate( "SimplifyChecker", '''Use "class {0}:" instead of "class {0}(object):"'''), + + # Comparations + "Y201": QCoreApplication.translate( + "SimplifyChecker", + '''Use "{0} != {1}" instead of "not {0} == {1}"'''), + "Y202": QCoreApplication.translate( + "SimplifyChecker", + '''Use "{0} == {1}" instead of "not {0} != {1}"'''), + "Y203": QCoreApplication.translate( + "SimplifyChecker", + '''Use "{0} not in {1}" instead of "not {0} in {1}"'''), + "Y204": QCoreApplication.translate( + "SimplifyChecker", + '''Use "{0} >= {1}" instead of "not ({0} < {1})"'''), + "Y205": QCoreApplication.translate( + "SimplifyChecker", + '''Use "{0} > {1}" instead of "not ({0} <= {1})"'''), + "Y206": QCoreApplication.translate( + "SimplifyChecker", + '''Use "{0} <= {1}" instead of "not ({0} > {1})"'''), + "Y207": QCoreApplication.translate( + "SimplifyChecker", + '''Use "{0} < {1}" instead of "not ({0} >= {1})"'''), + "Y208": QCoreApplication.translate( + "SimplifyChecker", + '''Use "{0}" instead of "not (not {0})"'''), + + "Y211": QCoreApplication.translate( + "SimplifyChecker", + '''Use "{1}" instead of "True if {0} else False"'''), + "Y212": QCoreApplication.translate( + "SimplifyChecker", + '''Use "{1}" instead of "False if {0} else True"'''), + "Y213": QCoreApplication.translate( + "SimplifyChecker", + '''Use "{0} if {0} else {1}" instead of "{1} if not {0} else {0}"'''), + + "Y221": QCoreApplication.translate( + "SimplifyChecker", + '''Use "False" instead of "{0} and not {0}"'''), + "Y222": QCoreApplication.translate( + "SimplifyChecker", + '''Use "True" instead of "{0} or not {0}"'''), + "Y223": QCoreApplication.translate( + "SimplifyChecker", + '''Use "True" instead of "... or True"'''), + "Y224": QCoreApplication.translate( + "SimplifyChecker", + '''Use "False" instead of "... and False"'''), + + "Y301": QCoreApplication.translate( + "SimplifyChecker", + '''Use "{1} == {0}" instead of "{0} == {1}" (Yoda-condition)'''), } _simplifyMessagesSampleArgs = { + # Python-specifics "Y101": ["foo"], "Y103": ["foo != bar"], "Y104": ["iterable"], @@ -94,4 +149,23 @@ "Y118": ["foo", "bar_dict"], "Y119": ["Foo"], "Y120": ["Foo"], + + # Comparations + "Y201": ["foo", "bar"], + "Y202": ["foo", "bar"], + "Y203": ["foo", "bar"], + "Y204": ["foo", "bar"], + "Y205": ["foo", "bar"], + "Y206": ["foo", "bar"], + "Y207": ["foo", "bar"], + "Y208": ["foo"], + + "Y211": ["foo", "bool(foo"], + "Y212": ["foo", "not foo"], + "Y213": ["foo", "bar"], + + "Y221": ["foo"], + "Y222": ["foo"], + + "Y301": ["42", "foo"], }