11 |
11 |
12 from PyQt6.QtCore import QCoreApplication |
12 from PyQt6.QtCore import QCoreApplication |
13 |
13 |
14 _miscellaneousMessages = { |
14 _miscellaneousMessages = { |
15 "M101": QCoreApplication.translate( |
15 "M101": QCoreApplication.translate( |
16 "MiscellaneousChecker", |
16 "MiscellaneousChecker", "coding magic comment not found" |
17 "coding magic comment not found"), |
17 ), |
18 "M102": QCoreApplication.translate( |
18 "M102": QCoreApplication.translate( |
19 "MiscellaneousChecker", |
19 "MiscellaneousChecker", "unknown encoding ({0}) found in coding magic comment" |
20 "unknown encoding ({0}) found in coding magic comment"), |
20 ), |
21 "M111": QCoreApplication.translate( |
21 "M111": QCoreApplication.translate( |
22 "MiscellaneousChecker", |
22 "MiscellaneousChecker", "copyright notice not present" |
23 "copyright notice not present"), |
23 ), |
24 "M112": QCoreApplication.translate( |
24 "M112": QCoreApplication.translate( |
25 "MiscellaneousChecker", |
25 "MiscellaneousChecker", "copyright notice contains invalid author" |
26 "copyright notice contains invalid author"), |
26 ), |
27 "M131": QCoreApplication.translate( |
27 "M131": QCoreApplication.translate( |
28 "MiscellaneousChecker", |
28 "MiscellaneousChecker", |
29 '"{0}" is a Python builtin and is being shadowed; ' |
29 '"{0}" is a Python builtin and is being shadowed; ' |
30 'consider renaming the variable'), |
30 "consider renaming the variable", |
|
31 ), |
31 "M132": QCoreApplication.translate( |
32 "M132": QCoreApplication.translate( |
32 "MiscellaneousChecker", |
33 "MiscellaneousChecker", |
33 '"{0}" is used as an argument and thus shadows a ' |
34 '"{0}" is used as an argument and thus shadows a ' |
34 'Python builtin; consider renaming the argument'), |
35 "Python builtin; consider renaming the argument", |
|
36 ), |
35 "M181": QCoreApplication.translate( |
37 "M181": QCoreApplication.translate( |
36 "MiscellaneousChecker", |
38 "MiscellaneousChecker", |
37 'unnecessary generator - rewrite as a list comprehension'), |
39 "unnecessary generator - rewrite as a list comprehension", |
|
40 ), |
38 "M182": QCoreApplication.translate( |
41 "M182": QCoreApplication.translate( |
39 "MiscellaneousChecker", |
42 "MiscellaneousChecker", "unnecessary generator - rewrite as a set comprehension" |
40 'unnecessary generator - rewrite as a set comprehension'), |
43 ), |
41 "M183": QCoreApplication.translate( |
44 "M183": QCoreApplication.translate( |
42 "MiscellaneousChecker", |
45 "MiscellaneousChecker", |
43 'unnecessary generator - rewrite as a dict comprehension'), |
46 "unnecessary generator - rewrite as a dict comprehension", |
|
47 ), |
44 "M184": QCoreApplication.translate( |
48 "M184": QCoreApplication.translate( |
45 "MiscellaneousChecker", |
49 "MiscellaneousChecker", |
46 'unnecessary list comprehension - rewrite as a set comprehension'), |
50 "unnecessary list comprehension - rewrite as a set comprehension", |
|
51 ), |
47 "M185": QCoreApplication.translate( |
52 "M185": QCoreApplication.translate( |
48 "MiscellaneousChecker", |
53 "MiscellaneousChecker", |
49 'unnecessary list comprehension - rewrite as a dict comprehension'), |
54 "unnecessary list comprehension - rewrite as a dict comprehension", |
|
55 ), |
50 "M186": QCoreApplication.translate( |
56 "M186": QCoreApplication.translate( |
51 "MiscellaneousChecker", |
57 "MiscellaneousChecker", "unnecessary {0} call - rewrite as a literal" |
52 'unnecessary {0} call - rewrite as a literal'), |
58 ), |
53 "M187a": QCoreApplication.translate( |
59 "M187a": QCoreApplication.translate( |
54 "MiscellaneousChecker", |
60 "MiscellaneousChecker", |
55 'unnecessary {0} call around {1}()' |
61 "unnecessary {0} call around {1}()" " - toggle reverse argument to sorted()", |
56 ' - toggle reverse argument to sorted()'), |
62 ), |
57 "M187b": QCoreApplication.translate( |
63 "M187b": QCoreApplication.translate( |
58 "MiscellaneousChecker", |
64 "MiscellaneousChecker", |
59 'unnecessary {0} call around {1}() - use sorted(..., reverse={2})'), |
65 "unnecessary {0} call around {1}() - use sorted(..., reverse={2})", |
|
66 ), |
60 "M187c": QCoreApplication.translate( |
67 "M187c": QCoreApplication.translate( |
61 "MiscellaneousChecker", |
68 "MiscellaneousChecker", "unnecessary {0} call around {1}()" |
62 'unnecessary {0} call around {1}()'), |
69 ), |
63 "M188": QCoreApplication.translate( |
70 "M188": QCoreApplication.translate( |
64 "MiscellaneousChecker", |
71 "MiscellaneousChecker", "unnecessary {0} call within {1}()" |
65 'unnecessary {0} call within {1}()'), |
72 ), |
66 "M189": QCoreApplication.translate( |
73 "M189": QCoreApplication.translate( |
67 "MiscellaneousChecker", |
74 "MiscellaneousChecker", |
68 'unnecessary subscript reversal of iterable within {0}()'), |
75 "unnecessary subscript reversal of iterable within {0}()", |
|
76 ), |
69 "M191": QCoreApplication.translate( |
77 "M191": QCoreApplication.translate( |
70 "MiscellaneousChecker", |
78 "MiscellaneousChecker", "unnecessary {0} literal - rewrite as a {1} literal" |
71 'unnecessary {0} literal - rewrite as a {1} literal'), |
79 ), |
72 "M192": QCoreApplication.translate( |
80 "M192": QCoreApplication.translate( |
73 "MiscellaneousChecker", |
81 "MiscellaneousChecker", |
74 'unnecessary {0} passed to tuple() - rewrite as a {1} literal'), |
82 "unnecessary {0} passed to tuple() - rewrite as a {1} literal", |
|
83 ), |
75 "M193": QCoreApplication.translate( |
84 "M193": QCoreApplication.translate( |
76 "MiscellaneousChecker", |
85 "MiscellaneousChecker", |
77 'unnecessary {0} passed to list() - rewrite as a {1} literal'), |
86 "unnecessary {0} passed to list() - rewrite as a {1} literal", |
|
87 ), |
78 "M195": QCoreApplication.translate( |
88 "M195": QCoreApplication.translate( |
79 "MiscellaneousChecker", |
89 "MiscellaneousChecker", |
80 'unnecessary list call - remove the outer call to list()'), |
90 "unnecessary list call - remove the outer call to list()", |
|
91 ), |
81 "M196": QCoreApplication.translate( |
92 "M196": QCoreApplication.translate( |
82 "MiscellaneousChecker", |
93 "MiscellaneousChecker", "unnecessary {0} comprehension - rewrite using {0}()" |
83 'unnecessary {0} comprehension - rewrite using {0}()'), |
94 ), |
84 "M197": QCoreApplication.translate( |
95 "M197": QCoreApplication.translate( |
85 "MiscellaneousChecker", |
96 "MiscellaneousChecker", |
86 'unnecessary {0} passed to tuple() - remove the outer call to {1}()'), |
97 "unnecessary {0} passed to tuple() - remove the outer call to {1}()", |
|
98 ), |
87 "M198": QCoreApplication.translate( |
99 "M198": QCoreApplication.translate( |
88 "MiscellaneousChecker", |
100 "MiscellaneousChecker", |
89 'unnecessary {0} passed to list() - remove the outer call to {1}()'), |
101 "unnecessary {0} passed to list() - remove the outer call to {1}()", |
90 |
102 ), |
91 "M201": QCoreApplication.translate( |
103 "M201": QCoreApplication.translate( |
92 "MiscellaneousChecker", |
104 "MiscellaneousChecker", "sort keys - '{0}' should be before '{1}'" |
93 "sort keys - '{0}' should be before '{1}'"), |
105 ), |
94 |
|
95 "M301": QCoreApplication.translate( |
106 "M301": QCoreApplication.translate( |
96 "MiscellaneousChecker", |
107 "MiscellaneousChecker", |
97 "use of 'datetime.datetime()' without 'tzinfo' argument should be" |
108 "use of 'datetime.datetime()' without 'tzinfo' argument should be" " avoided", |
98 " avoided"), |
109 ), |
99 "M302": QCoreApplication.translate( |
110 "M302": QCoreApplication.translate( |
100 "MiscellaneousChecker", |
111 "MiscellaneousChecker", |
101 "use of 'datetime.datetime.today()' should be avoided.\n" |
112 "use of 'datetime.datetime.today()' should be avoided.\n" |
102 "Use 'datetime.datetime.now(tz=)' instead."), |
113 "Use 'datetime.datetime.now(tz=)' instead.", |
|
114 ), |
103 "M303": QCoreApplication.translate( |
115 "M303": QCoreApplication.translate( |
104 "MiscellaneousChecker", |
116 "MiscellaneousChecker", |
105 "use of 'datetime.datetime.utcnow()' should be avoided.\n" |
117 "use of 'datetime.datetime.utcnow()' should be avoided.\n" |
106 "Use 'datetime.datetime.now(tz=)' instead."), |
118 "Use 'datetime.datetime.now(tz=)' instead.", |
|
119 ), |
107 "M304": QCoreApplication.translate( |
120 "M304": QCoreApplication.translate( |
108 "MiscellaneousChecker", |
121 "MiscellaneousChecker", |
109 "use of 'datetime.datetime.utcfromtimestamp()' should be avoided.\n" |
122 "use of 'datetime.datetime.utcfromtimestamp()' should be avoided.\n" |
110 "Use 'datetime.datetime.fromtimestamp(, tz=)' instead."), |
123 "Use 'datetime.datetime.fromtimestamp(, tz=)' instead.", |
|
124 ), |
111 "M305": QCoreApplication.translate( |
125 "M305": QCoreApplication.translate( |
112 "MiscellaneousChecker", |
126 "MiscellaneousChecker", |
113 "use of 'datetime.datetime.now()' without 'tz' argument should be" |
127 "use of 'datetime.datetime.now()' without 'tz' argument should be" " avoided", |
114 " avoided"), |
128 ), |
115 "M306": QCoreApplication.translate( |
129 "M306": QCoreApplication.translate( |
116 "MiscellaneousChecker", |
130 "MiscellaneousChecker", |
117 "use of 'datetime.datetime.fromtimestamp()' without 'tz' argument" |
131 "use of 'datetime.datetime.fromtimestamp()' without 'tz' argument" |
118 " should be avoided"), |
132 " should be avoided", |
|
133 ), |
119 "M307": QCoreApplication.translate( |
134 "M307": QCoreApplication.translate( |
120 "MiscellaneousChecker", |
135 "MiscellaneousChecker", |
121 "use of 'datetime.datetime.strptime()' should be followed by" |
136 "use of 'datetime.datetime.strptime()' should be followed by" |
122 " '.replace(tzinfo=)'"), |
137 " '.replace(tzinfo=)'", |
|
138 ), |
123 "M308": QCoreApplication.translate( |
139 "M308": QCoreApplication.translate( |
124 "MiscellaneousChecker", |
140 "MiscellaneousChecker", |
125 "use of 'datetime.datetime.fromordinal()' should be avoided"), |
141 "use of 'datetime.datetime.fromordinal()' should be avoided", |
|
142 ), |
126 "M311": QCoreApplication.translate( |
143 "M311": QCoreApplication.translate( |
127 "MiscellaneousChecker", |
144 "MiscellaneousChecker", |
128 "use of 'datetime.date()' should be avoided.\n" |
145 "use of 'datetime.date()' should be avoided.\n" |
129 "Use 'datetime.datetime(, tzinfo=).date()' instead."), |
146 "Use 'datetime.datetime(, tzinfo=).date()' instead.", |
|
147 ), |
130 "M312": QCoreApplication.translate( |
148 "M312": QCoreApplication.translate( |
131 "MiscellaneousChecker", |
149 "MiscellaneousChecker", |
132 "use of 'datetime.date.today()' should be avoided.\n" |
150 "use of 'datetime.date.today()' should be avoided.\n" |
133 "Use 'datetime.datetime.now(tz=).date()' instead."), |
151 "Use 'datetime.datetime.now(tz=).date()' instead.", |
|
152 ), |
134 "M313": QCoreApplication.translate( |
153 "M313": QCoreApplication.translate( |
135 "MiscellaneousChecker", |
154 "MiscellaneousChecker", |
136 "use of 'datetime.date.fromtimestamp()' should be avoided.\n" |
155 "use of 'datetime.date.fromtimestamp()' should be avoided.\n" |
137 "Use 'datetime.datetime.fromtimestamp(tz=).date()' instead."), |
156 "Use 'datetime.datetime.fromtimestamp(tz=).date()' instead.", |
|
157 ), |
138 "M314": QCoreApplication.translate( |
158 "M314": QCoreApplication.translate( |
139 "MiscellaneousChecker", |
159 "MiscellaneousChecker", "use of 'datetime.date.fromordinal()' should be avoided" |
140 "use of 'datetime.date.fromordinal()' should be avoided"), |
160 ), |
141 "M315": QCoreApplication.translate( |
161 "M315": QCoreApplication.translate( |
142 "MiscellaneousChecker", |
162 "MiscellaneousChecker", |
143 "use of 'datetime.date.fromisoformat()' should be avoided"), |
163 "use of 'datetime.date.fromisoformat()' should be avoided", |
|
164 ), |
144 "M321": QCoreApplication.translate( |
165 "M321": QCoreApplication.translate( |
145 "MiscellaneousChecker", |
166 "MiscellaneousChecker", |
146 "use of 'datetime.time()' without 'tzinfo' argument should be" |
167 "use of 'datetime.time()' without 'tzinfo' argument should be" " avoided", |
147 " avoided"), |
168 ), |
148 |
|
149 "M401": QCoreApplication.translate( |
169 "M401": QCoreApplication.translate( |
150 "MiscellaneousChecker", |
170 "MiscellaneousChecker", |
151 "'sys.version[:3]' referenced (Python 3.10), use 'sys.version_info'"), |
171 "'sys.version[:3]' referenced (Python 3.10), use 'sys.version_info'", |
|
172 ), |
152 "M402": QCoreApplication.translate( |
173 "M402": QCoreApplication.translate( |
153 "MiscellaneousChecker", |
174 "MiscellaneousChecker", |
154 "'sys.version[2]' referenced (Python 3.10), use 'sys.version_info'"), |
175 "'sys.version[2]' referenced (Python 3.10), use 'sys.version_info'", |
|
176 ), |
155 "M403": QCoreApplication.translate( |
177 "M403": QCoreApplication.translate( |
156 "MiscellaneousChecker", |
178 "MiscellaneousChecker", |
157 "'sys.version' compared to string (Python 3.10), use" |
179 "'sys.version' compared to string (Python 3.10), use" " 'sys.version_info'", |
158 " 'sys.version_info'"), |
180 ), |
159 "M411": QCoreApplication.translate( |
181 "M411": QCoreApplication.translate( |
160 "MiscellaneousChecker", |
182 "MiscellaneousChecker", |
161 "'sys.version_info[0] == 3' referenced (Python 4), use '>='"), |
183 "'sys.version_info[0] == 3' referenced (Python 4), use '>='", |
|
184 ), |
162 "M412": QCoreApplication.translate( |
185 "M412": QCoreApplication.translate( |
163 "MiscellaneousChecker", |
186 "MiscellaneousChecker", "'six.PY3' referenced (Python 4), use 'not six.PY2'" |
164 "'six.PY3' referenced (Python 4), use 'not six.PY2'"), |
187 ), |
165 "M413": QCoreApplication.translate( |
188 "M413": QCoreApplication.translate( |
166 "MiscellaneousChecker", |
189 "MiscellaneousChecker", |
167 "'sys.version_info[1]' compared to integer (Python 4)," |
190 "'sys.version_info[1]' compared to integer (Python 4)," |
168 " compare 'sys.version_info' to tuple"), |
191 " compare 'sys.version_info' to tuple", |
|
192 ), |
169 "M414": QCoreApplication.translate( |
193 "M414": QCoreApplication.translate( |
170 "MiscellaneousChecker", |
194 "MiscellaneousChecker", |
171 "'sys.version_info.minor' compared to integer (Python 4)," |
195 "'sys.version_info.minor' compared to integer (Python 4)," |
172 " compare 'sys.version_info' to tuple"), |
196 " compare 'sys.version_info' to tuple", |
|
197 ), |
173 "M421": QCoreApplication.translate( |
198 "M421": QCoreApplication.translate( |
174 "MiscellaneousChecker", |
199 "MiscellaneousChecker", |
175 "'sys.version[0]' referenced (Python 10), use 'sys.version_info'"), |
200 "'sys.version[0]' referenced (Python 10), use 'sys.version_info'", |
|
201 ), |
176 "M422": QCoreApplication.translate( |
202 "M422": QCoreApplication.translate( |
177 "MiscellaneousChecker", |
203 "MiscellaneousChecker", |
178 "'sys.version' compared to string (Python 10)," |
204 "'sys.version' compared to string (Python 10)," " use 'sys.version_info'", |
179 " use 'sys.version_info'"), |
205 ), |
180 "M423": QCoreApplication.translate( |
206 "M423": QCoreApplication.translate( |
181 "MiscellaneousChecker", |
207 "MiscellaneousChecker", |
182 "'sys.version[:1]' referenced (Python 10), use 'sys.version_info'"), |
208 "'sys.version[:1]' referenced (Python 10), use 'sys.version_info'", |
183 |
209 ), |
184 "M501": QCoreApplication.translate( |
210 "M501": QCoreApplication.translate( |
185 "MiscellaneousChecker", |
211 "MiscellaneousChecker", "Python does not support the unary prefix increment" |
186 "Python does not support the unary prefix increment"), |
212 ), |
187 "M502": QCoreApplication.translate( |
213 "M502": QCoreApplication.translate( |
188 "MiscellaneousChecker", |
214 "MiscellaneousChecker", |
189 "using .strip() with multi-character strings is misleading"), |
215 "using .strip() with multi-character strings is misleading", |
|
216 ), |
190 "M503": QCoreApplication.translate( |
217 "M503": QCoreApplication.translate( |
191 "MiscellaneousChecker", |
218 "MiscellaneousChecker", |
192 "do not call assert False since python -O removes these calls"), |
219 "do not call assert False since python -O removes these calls", |
|
220 ), |
193 "M504": QCoreApplication.translate( |
221 "M504": QCoreApplication.translate( |
194 "MiscellaneousChecker", |
222 "MiscellaneousChecker", |
195 "'sys.maxint' is not defined in Python 3 - use 'sys.maxsize'"), |
223 "'sys.maxint' is not defined in Python 3 - use 'sys.maxsize'", |
|
224 ), |
196 "M505": QCoreApplication.translate( |
225 "M505": QCoreApplication.translate( |
197 "MiscellaneousChecker", |
226 "MiscellaneousChecker", |
198 "'BaseException.message' has been deprecated as of Python 2.6 and is" |
227 "'BaseException.message' has been deprecated as of Python 2.6 and is" |
199 " removed in Python 3 - use 'str(e)'"), |
228 " removed in Python 3 - use 'str(e)'", |
|
229 ), |
200 "M506": QCoreApplication.translate( |
230 "M506": QCoreApplication.translate( |
201 "MiscellaneousChecker", |
231 "MiscellaneousChecker", |
202 "assigning to 'os.environ' does not clear the environment -" |
232 "assigning to 'os.environ' does not clear the environment -" |
203 " use 'os.environ.clear()'"), |
233 " use 'os.environ.clear()'", |
|
234 ), |
204 "M507": QCoreApplication.translate( |
235 "M507": QCoreApplication.translate( |
205 "MiscellaneousChecker", |
236 "MiscellaneousChecker", |
206 "loop control variable {0} not used within the loop body -" |
237 "loop control variable {0} not used within the loop body -" |
207 " start the name with an underscore"), |
238 " start the name with an underscore", |
208 "M508": QCoreApplication.translate( |
239 ), |
209 "MiscellaneousChecker", |
240 "M508": QCoreApplication.translate("MiscellaneousChecker", "unncessary f-string"), |
210 "unncessary f-string"), |
|
211 "M509": QCoreApplication.translate( |
241 "M509": QCoreApplication.translate( |
212 "MiscellaneousChecker", |
242 "MiscellaneousChecker", |
213 "cannot use 'self.__class__' as first argument of 'super()' call"), |
243 "cannot use 'self.__class__' as first argument of 'super()' call", |
|
244 ), |
214 "M511": QCoreApplication.translate( |
245 "M511": QCoreApplication.translate( |
215 "MiscellaneousChecker", |
246 "MiscellaneousChecker", |
216 """using 'hasattr(x, "__call__")' to test if 'x' is callable is""" |
247 """using 'hasattr(x, "__call__")' to test if 'x' is callable is""" |
217 """ unreliable"""), |
248 """ unreliable""", |
|
249 ), |
218 "M512": QCoreApplication.translate( |
250 "M512": QCoreApplication.translate( |
219 "MiscellaneousChecker", |
251 "MiscellaneousChecker", "do not call getattr with a constant attribute value" |
220 "do not call getattr with a constant attribute value"), |
252 ), |
221 "M513": QCoreApplication.translate( |
253 "M513": QCoreApplication.translate( |
222 "MiscellaneousChecker", |
254 "MiscellaneousChecker", "do not call setattr with a constant attribute value" |
223 "do not call setattr with a constant attribute value"), |
255 ), |
224 "M521": QCoreApplication.translate( |
256 "M521": QCoreApplication.translate( |
225 "MiscellaneousChecker", |
257 "MiscellaneousChecker", |
226 "Python 3 does not include '.iter*' methods on dictionaries"), |
258 "Python 3 does not include '.iter*' methods on dictionaries", |
|
259 ), |
227 "M522": QCoreApplication.translate( |
260 "M522": QCoreApplication.translate( |
228 "MiscellaneousChecker", |
261 "MiscellaneousChecker", |
229 "Python 3 does not include '.view*' methods on dictionaries"), |
262 "Python 3 does not include '.view*' methods on dictionaries", |
|
263 ), |
230 "M523": QCoreApplication.translate( |
264 "M523": QCoreApplication.translate( |
231 "MiscellaneousChecker", |
265 "MiscellaneousChecker", "'.next()' does not exist in Python 3" |
232 "'.next()' does not exist in Python 3"), |
266 ), |
233 "M524": QCoreApplication.translate( |
267 "M524": QCoreApplication.translate( |
234 "MiscellaneousChecker", |
268 "MiscellaneousChecker", |
235 "'__metaclass__' does nothing on Python 3 -" |
269 "'__metaclass__' does nothing on Python 3 -" |
236 " use 'class MyClass(BaseClass, metaclass=...)'"), |
270 " use 'class MyClass(BaseClass, metaclass=...)'", |
237 |
271 ), |
238 "M601": QCoreApplication.translate( |
272 "M601": QCoreApplication.translate("MiscellaneousChecker", "found {0} formatter"), |
239 "MiscellaneousChecker", |
|
240 "found {0} formatter"), |
|
241 "M611": QCoreApplication.translate( |
273 "M611": QCoreApplication.translate( |
242 "MiscellaneousChecker", |
274 "MiscellaneousChecker", "format string does contain unindexed parameters" |
243 "format string does contain unindexed parameters"), |
275 ), |
244 "M612": QCoreApplication.translate( |
276 "M612": QCoreApplication.translate( |
245 "MiscellaneousChecker", |
277 "MiscellaneousChecker", "docstring does contain unindexed parameters" |
246 "docstring does contain unindexed parameters"), |
278 ), |
247 "M613": QCoreApplication.translate( |
279 "M613": QCoreApplication.translate( |
248 "MiscellaneousChecker", |
280 "MiscellaneousChecker", "other string does contain unindexed parameters" |
249 "other string does contain unindexed parameters"), |
281 ), |
250 "M621": QCoreApplication.translate( |
282 "M621": QCoreApplication.translate( |
251 "MiscellaneousChecker", |
283 "MiscellaneousChecker", "format call uses too large index ({0})" |
252 "format call uses too large index ({0})"), |
284 ), |
253 "M622": QCoreApplication.translate( |
285 "M622": QCoreApplication.translate( |
254 "MiscellaneousChecker", |
286 "MiscellaneousChecker", "format call uses missing keyword ({0})" |
255 "format call uses missing keyword ({0})"), |
287 ), |
256 "M623": QCoreApplication.translate( |
288 "M623": QCoreApplication.translate( |
257 "MiscellaneousChecker", |
289 "MiscellaneousChecker", |
258 "format call uses keyword arguments but no named entries"), |
290 "format call uses keyword arguments but no named entries", |
|
291 ), |
259 "M624": QCoreApplication.translate( |
292 "M624": QCoreApplication.translate( |
260 "MiscellaneousChecker", |
293 "MiscellaneousChecker", |
261 "format call uses variable arguments but no numbered entries"), |
294 "format call uses variable arguments but no numbered entries", |
|
295 ), |
262 "M625": QCoreApplication.translate( |
296 "M625": QCoreApplication.translate( |
263 "MiscellaneousChecker", |
297 "MiscellaneousChecker", |
264 "format call uses implicit and explicit indexes together"), |
298 "format call uses implicit and explicit indexes together", |
|
299 ), |
265 "M631": QCoreApplication.translate( |
300 "M631": QCoreApplication.translate( |
266 "MiscellaneousChecker", |
301 "MiscellaneousChecker", "format call provides unused index ({0})" |
267 "format call provides unused index ({0})"), |
302 ), |
268 "M632": QCoreApplication.translate( |
303 "M632": QCoreApplication.translate( |
269 "MiscellaneousChecker", |
304 "MiscellaneousChecker", "format call provides unused keyword ({0})" |
270 "format call provides unused keyword ({0})"), |
305 ), |
271 "M651": QCoreApplication.translate( |
306 "M651": QCoreApplication.translate( |
272 "MiscellaneousChecker", |
307 "MiscellaneousChecker", "logging statement uses string.format()" |
273 "logging statement uses string.format()"), |
308 ), |
274 "M652": QCoreApplication.translate( |
309 "M652": QCoreApplication.translate( |
275 "MiscellaneousChecker", |
310 "MiscellaneousChecker", "logging statement uses '%'" # __IGNORE_WARNING_M601__ |
276 "logging statement uses '%'"), # __IGNORE_WARNING_M601__ |
311 ), |
277 "M653": QCoreApplication.translate( |
312 "M653": QCoreApplication.translate( |
278 "MiscellaneousChecker", |
313 "MiscellaneousChecker", "logging statement uses '+'" |
279 "logging statement uses '+'"), |
314 ), |
280 "M654": QCoreApplication.translate( |
315 "M654": QCoreApplication.translate( |
281 "MiscellaneousChecker", |
316 "MiscellaneousChecker", "logging statement uses f-string" |
282 "logging statement uses f-string"), |
317 ), |
283 "M655": QCoreApplication.translate( |
318 "M655": QCoreApplication.translate( |
284 "MiscellaneousChecker", |
319 "MiscellaneousChecker", "logging statement uses 'warn' instead of 'warning'" |
285 "logging statement uses 'warn' instead of 'warning'"), |
320 ), |
286 |
|
287 "M701": QCoreApplication.translate( |
321 "M701": QCoreApplication.translate( |
288 "MiscellaneousChecker", |
322 "MiscellaneousChecker", |
289 "expected these __future__ imports: {0}; but only got: {1}"), |
323 "expected these __future__ imports: {0}; but only got: {1}", |
|
324 ), |
290 "M702": QCoreApplication.translate( |
325 "M702": QCoreApplication.translate( |
291 "MiscellaneousChecker", |
326 "MiscellaneousChecker", "expected these __future__ imports: {0}; but got none" |
292 "expected these __future__ imports: {0}; but got none"), |
327 ), |
293 "M711": QCoreApplication.translate( |
328 "M711": QCoreApplication.translate( |
294 "MiscellaneousChecker", |
329 "MiscellaneousChecker", "gettext import with alias _ found: {0}" |
295 "gettext import with alias _ found: {0}"), |
330 ), |
296 |
331 "M801": QCoreApplication.translate("MiscellaneousChecker", "print statement found"), |
297 "M801": QCoreApplication.translate( |
|
298 "MiscellaneousChecker", |
|
299 "print statement found"), |
|
300 "M811": QCoreApplication.translate( |
332 "M811": QCoreApplication.translate( |
301 "MiscellaneousChecker", |
333 "MiscellaneousChecker", "one element tuple found" |
302 "one element tuple found"), |
334 ), |
303 "M821": QCoreApplication.translate( |
335 "M821": QCoreApplication.translate( |
304 "MiscellaneousChecker", |
336 "MiscellaneousChecker", "mutable default argument of type {0}" |
305 "mutable default argument of type {0}"), |
337 ), |
306 "M822": QCoreApplication.translate( |
338 "M822": QCoreApplication.translate( |
307 "MiscellaneousChecker", |
339 "MiscellaneousChecker", "mutable default argument of type {0}" |
308 "mutable default argument of type {0}"), |
340 ), |
309 "M823": QCoreApplication.translate( |
341 "M823": QCoreApplication.translate( |
310 "MiscellaneousChecker", |
342 "MiscellaneousChecker", "mutable default argument of function call '{0}'" |
311 "mutable default argument of function call '{0}'"), |
343 ), |
312 "M831": QCoreApplication.translate( |
344 "M831": QCoreApplication.translate( |
313 "MiscellaneousChecker", |
345 "MiscellaneousChecker", |
314 "None should not be added at any return if function has no return" |
346 "None should not be added at any return if function has no return" |
315 " value except None"), |
347 " value except None", |
|
348 ), |
316 "M832": QCoreApplication.translate( |
349 "M832": QCoreApplication.translate( |
317 "MiscellaneousChecker", |
350 "MiscellaneousChecker", |
318 "an explicit value at every return should be added if function has" |
351 "an explicit value at every return should be added if function has" |
319 " a return value except None"), |
352 " a return value except None", |
|
353 ), |
320 "M833": QCoreApplication.translate( |
354 "M833": QCoreApplication.translate( |
321 "MiscellaneousChecker", |
355 "MiscellaneousChecker", |
322 "an explicit return at the end of the function should be added if" |
356 "an explicit return at the end of the function should be added if" |
323 " it has a return value except None"), |
357 " it has a return value except None", |
|
358 ), |
324 "M834": QCoreApplication.translate( |
359 "M834": QCoreApplication.translate( |
325 "MiscellaneousChecker", |
360 "MiscellaneousChecker", |
326 "a value should not be assigned to a variable if it will be used as a" |
361 "a value should not be assigned to a variable if it will be used as a" |
327 " return value only"), |
362 " return value only", |
|
363 ), |
328 "M841": QCoreApplication.translate( |
364 "M841": QCoreApplication.translate( |
329 "MiscellaneousChecker", |
365 "MiscellaneousChecker", |
330 "prefer implied line continuation inside parentheses, " |
366 "prefer implied line continuation inside parentheses, " |
331 "brackets and braces as opposed to a backslash"), |
367 "brackets and braces as opposed to a backslash", |
|
368 ), |
332 "M891": QCoreApplication.translate( |
369 "M891": QCoreApplication.translate( |
333 "MiscellaneousChecker", |
370 "MiscellaneousChecker", "commented code lines should be removed" |
334 "commented code lines should be removed"), |
371 ), |
335 } |
372 } |
336 |
373 |
337 _miscellaneousMessagesSampleArgs = { |
374 _miscellaneousMessagesSampleArgs = { |
338 "M102": ["enc42"], |
375 "M102": ["enc42"], |
339 "M131": ["list"], |
376 "M131": ["list"], |