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

changeset 8195
db7f2badd374
parent 8194
b925628bf91f
child 8202
df194f43119c
equal deleted inserted replaced
8194:b925628bf91f 8195:db7f2badd374
10 """ 10 """
11 11
12 from PyQt5.QtCore import QCoreApplication 12 from PyQt5.QtCore import QCoreApplication
13 13
14 _simplifyMessages = { 14 _simplifyMessages = {
15 # Python-specifics
15 "Y101": QCoreApplication.translate( 16 "Y101": QCoreApplication.translate(
16 "SimplifyChecker", 17 "SimplifyChecker",
17 '''Multiple "isinstance()" calls which can be merged into a single ''' 18 '''Multiple "isinstance()" calls which can be merged into a single '''
18 '''call for variable "{0}"'''), 19 '''call for variable "{0}"'''),
19 "Y102": QCoreApplication.translate( 20 "Y102": QCoreApplication.translate(
73 "SimplifyChecker", 74 "SimplifyChecker",
74 '''Use a dataclass for "class {0}"'''), 75 '''Use a dataclass for "class {0}"'''),
75 "Y120": QCoreApplication.translate( 76 "Y120": QCoreApplication.translate(
76 "SimplifyChecker", 77 "SimplifyChecker",
77 '''Use "class {0}:" instead of "class {0}(object):"'''), 78 '''Use "class {0}:" instead of "class {0}(object):"'''),
79
80 # Comparations
81 "Y201": QCoreApplication.translate(
82 "SimplifyChecker",
83 '''Use "{0} != {1}" instead of "not {0} == {1}"'''),
84 "Y202": QCoreApplication.translate(
85 "SimplifyChecker",
86 '''Use "{0} == {1}" instead of "not {0} != {1}"'''),
87 "Y203": QCoreApplication.translate(
88 "SimplifyChecker",
89 '''Use "{0} not in {1}" instead of "not {0} in {1}"'''),
90 "Y204": QCoreApplication.translate(
91 "SimplifyChecker",
92 '''Use "{0} >= {1}" instead of "not ({0} < {1})"'''),
93 "Y205": QCoreApplication.translate(
94 "SimplifyChecker",
95 '''Use "{0} > {1}" instead of "not ({0} <= {1})"'''),
96 "Y206": QCoreApplication.translate(
97 "SimplifyChecker",
98 '''Use "{0} <= {1}" instead of "not ({0} > {1})"'''),
99 "Y207": QCoreApplication.translate(
100 "SimplifyChecker",
101 '''Use "{0} < {1}" instead of "not ({0} >= {1})"'''),
102 "Y208": QCoreApplication.translate(
103 "SimplifyChecker",
104 '''Use "{0}" instead of "not (not {0})"'''),
105
106 "Y211": QCoreApplication.translate(
107 "SimplifyChecker",
108 '''Use "{1}" instead of "True if {0} else False"'''),
109 "Y212": QCoreApplication.translate(
110 "SimplifyChecker",
111 '''Use "{1}" instead of "False if {0} else True"'''),
112 "Y213": QCoreApplication.translate(
113 "SimplifyChecker",
114 '''Use "{0} if {0} else {1}" instead of "{1} if not {0} else {0}"'''),
115
116 "Y221": QCoreApplication.translate(
117 "SimplifyChecker",
118 '''Use "False" instead of "{0} and not {0}"'''),
119 "Y222": QCoreApplication.translate(
120 "SimplifyChecker",
121 '''Use "True" instead of "{0} or not {0}"'''),
122 "Y223": QCoreApplication.translate(
123 "SimplifyChecker",
124 '''Use "True" instead of "... or True"'''),
125 "Y224": QCoreApplication.translate(
126 "SimplifyChecker",
127 '''Use "False" instead of "... and False"'''),
128
129 "Y301": QCoreApplication.translate(
130 "SimplifyChecker",
131 '''Use "{1} == {0}" instead of "{0} == {1}" (Yoda-condition)'''),
78 } 132 }
79 133
80 _simplifyMessagesSampleArgs = { 134 _simplifyMessagesSampleArgs = {
135 # Python-specifics
81 "Y101": ["foo"], 136 "Y101": ["foo"],
82 "Y103": ["foo != bar"], 137 "Y103": ["foo != bar"],
83 "Y104": ["iterable"], 138 "Y104": ["iterable"],
84 "Y105": ["Exception"], 139 "Y105": ["Exception"],
85 "Y108": ["foo", "bar", "condition", "baz"], 140 "Y108": ["foo", "bar", "condition", "baz"],
92 "Y116": ["mapping.get(foo, 42)"], 147 "Y116": ["mapping.get(foo, 42)"],
93 "Y117": ["with Foo() as foo, Bar() as bar:"], 148 "Y117": ["with Foo() as foo, Bar() as bar:"],
94 "Y118": ["foo", "bar_dict"], 149 "Y118": ["foo", "bar_dict"],
95 "Y119": ["Foo"], 150 "Y119": ["Foo"],
96 "Y120": ["Foo"], 151 "Y120": ["Foo"],
152
153 # Comparations
154 "Y201": ["foo", "bar"],
155 "Y202": ["foo", "bar"],
156 "Y203": ["foo", "bar"],
157 "Y204": ["foo", "bar"],
158 "Y205": ["foo", "bar"],
159 "Y206": ["foo", "bar"],
160 "Y207": ["foo", "bar"],
161 "Y208": ["foo"],
162
163 "Y211": ["foo", "bool(foo"],
164 "Y212": ["foo", "not foo"],
165 "Y213": ["foo", "bar"],
166
167 "Y221": ["foo"],
168 "Y222": ["foo"],
169
170 "Y301": ["42", "foo"],
97 } 171 }

eric ide

mercurial