eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/translations.py

changeset 8189
17df5c8df8c1
parent 8186
655b658aa7ee
child 8191
9125da0c227e
equal deleted inserted replaced
8188:bfa6c0969acf 8189:17df5c8df8c1
4 # 4 #
5 5
6 6
7 """ 7 """
8 Module implementing message translations for the code style plugin messages 8 Module implementing message translations for the code style plugin messages
9 (miscellaneous part). 9 (simplify part).
10 """ 10 """
11 11
12 from PyQt5.QtCore import QCoreApplication 12 from PyQt5.QtCore import QCoreApplication
13 13
14 _simplifyMessages = { 14 _simplifyMessages = {
15 "Y101": QCoreApplication.translate( 15 "Y101": QCoreApplication.translate(
16 "SimplifyChecker", 16 "SimplifyChecker",
17 "Multiple 'isinstance()' calls which can be merged into a single " 17 """Multiple "isinstance()" calls which can be merged into a single """
18 "call for variable '{0}'"), 18 """call for variable '{0}'"""),
19 "Y102": QCoreApplication.translate(
20 "SimplifyChecker",
21 """Use a single if-statement instead of nested if-statements"""),
22 "Y103": QCoreApplication.translate(
23 "SimplifyChecker",
24 """Return the condition "{0}" directly"""),
25 "Y104": QCoreApplication.translate(
26 "SimplifyChecker",
27 """Use "yield from {0}" """),
28 "Y105": QCoreApplication.translate(
29 "SimplifyChecker",
30 """Use "with contextlib.suppress({0}):" """),
31 "Y106": QCoreApplication.translate(
32 "SimplifyChecker",
33 """Handle error-cases first"""),
34 "Y107": QCoreApplication.translate(
35 "SimplifyChecker",
36 """Don't use return in try/except and finally"""),
37 "Y108": QCoreApplication.translate(
38 "SimplifyChecker",
39 """Use ternary operator "{0} = {1} if {2} else {3}" """
40 """instead of if-else-block"""),
41 "Y109": QCoreApplication.translate(
42 "SimplifyChecker",
43 """Use "{0} in {1}" instead of "{2}" """),
44 "Y110": QCoreApplication.translate(
45 "SimplifyChecker",
46 """Use "return any({0} for {1} in {2})" """),
47 "Y111": QCoreApplication.translate(
48 "SimplifyChecker",
49 """Use "return all({0} for {1} in {2})" """),
50 "Y112": QCoreApplication.translate(
51 "SimplifyChecker",
52 """Use "{0}" instead of "{1}" """),
19 } 53 }
20 54
21 _simplifyMessagesSampleArgs = { 55 _simplifyMessagesSampleArgs = {
22 "Y101": ["foo"], 56 "Y101": ["foo"],
57 "Y103": ["foo != bar"],
58 "Y104": ["iterable"],
59 "Y105": ["Exception"],
60 "Y108": ["foo", "bar", "condition", "baz"],
61 "Y109": ["foo", "[1, 2]", "foo == 1 or foo == 2"],
62 "Y110": ["check", "foo", "iterable"],
63 "Y111": ["check", "foo", "iterable"],
64 "Y112": ["FOO", "foo"],
23 } 65 }

eric ide

mercurial