src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/translations.py

branch
eric7
changeset 10048
df836ff707fd
parent 9653
e67609152c5e
child 10050
3750abc45d5e
equal deleted inserted replaced
10047:cc9ead6d1c46 10048:df836ff707fd
207 "MiscellaneousChecker", 207 "MiscellaneousChecker",
208 "'sys.version[:1]' referenced (Python 10), use 'sys.version_info'", 208 "'sys.version[:1]' referenced (Python 10), use 'sys.version_info'",
209 ), 209 ),
210 "M501": QCoreApplication.translate( 210 "M501": QCoreApplication.translate(
211 "MiscellaneousChecker", 211 "MiscellaneousChecker",
212 "Do not use 'except (){0}:', it also catches unexpected events. Prefer" 212 "Do not use bare 'except:', it also catches unexpected events like memory"
213 " 'except Exception:'.", 213 " errors, interrupts, system exit, and so on. Prefer 'except Exception:'."
214 " If you're sure what you're doing, be explicit and write"
215 " 'except BaseException:'.",
214 ), 216 ),
215 "M502": QCoreApplication.translate( 217 "M502": QCoreApplication.translate(
216 "MiscellaneousChecker", "Python does not support the unary prefix increment" 218 "MiscellaneousChecker", "Python does not support the unary prefix increment"
217 ), 219 ),
218 "M503": QCoreApplication.translate( 220 "M503": QCoreApplication.translate(
225 """using 'hasattr(x, "__call__")' to test if 'x' is callable is""" 227 """using 'hasattr(x, "__call__")' to test if 'x' is callable is"""
226 """ unreliable. Use 'callable(x)' for consistent results.""", 228 """ unreliable. Use 'callable(x)' for consistent results.""",
227 ), 229 ),
228 "M505": QCoreApplication.translate( 230 "M505": QCoreApplication.translate(
229 "MiscellaneousChecker", 231 "MiscellaneousChecker",
230 "using .strip() with multi-character strings is misleading. Use " 232 "using .strip() with multi-character strings is misleading. Use .replace(),"
231 ".replace() or regular expressions to remove string fragments.", 233 " .removeprefix(), .removesuffix(), or regular expressions to remove string"
234 " fragments.",
232 ), 235 ),
233 "M507": QCoreApplication.translate( 236 "M507": QCoreApplication.translate(
234 "MiscellaneousChecker", 237 "MiscellaneousChecker",
235 "loop control variable {0} not used within the loop body -" 238 "loop control variable {0} not used within the loop body -"
236 " start the name with an underscore", 239 " start the name with an underscore",
270 "MiscellaneousChecker", 273 "MiscellaneousChecker",
271 "Cannot raise a literal. Did you intend to return it or raise an Exception?", 274 "Cannot raise a literal. Did you intend to return it or raise an Exception?",
272 ), 275 ),
273 "M517": QCoreApplication.translate( 276 "M517": QCoreApplication.translate(
274 "MiscellaneousChecker", 277 "MiscellaneousChecker",
275 "'assertRaises(Exception):' should be considered evil. It can lead to your test" 278 "'assertRaises(Exception)' and 'pytest.raises(Exception)' should "
276 " passing even if the code being tested is never executed due to a typo. Either" 279 "be considered evil. They can lead to your test passing even if the "
277 " assert for a more specific exception (builtin or custom), use" 280 "code being tested is never executed due to a typo. Assert for a more "
278 " 'assertRaisesRegex', or use the context manager form of 'assertRaises'.", 281 "specific exception (builtin or custom), or use 'assertRaisesRegex' "
282 "(if using 'assertRaises'), or add the 'match' keyword argument (if "
283 "using 'pytest.raises'), or use the context manager form with a target.",
279 ), 284 ),
280 "M518": QCoreApplication.translate( 285 "M518": QCoreApplication.translate(
281 "MiscellaneousChecker", 286 "MiscellaneousChecker",
282 "Found useless expression. Consider either assigning it to a variable or" 287 "Found useless expression. Consider either assigning it to a variable or"
283 " removing it.", 288 " removing it.",
307 "MiscellaneousChecker", 312 "MiscellaneousChecker",
308 "Function definition does not bind loop variable '{0}'.", 313 "Function definition does not bind loop variable '{0}'.",
309 ), 314 ),
310 "M524": QCoreApplication.translate( 315 "M524": QCoreApplication.translate(
311 "MiscellaneousChecker", 316 "MiscellaneousChecker",
312 "{0} is an abstract base class, but it has no abstract methods. Remember to" 317 "{0} is an abstract base class, but none of the methods it defines are"
313 " use the @abstractmethod decorator, potentially in conjunction with" 318 " abstract. This is not necessarily an error, but you might have forgotten to"
319 " add the @abstractmethod decorator, potentially in conjunction with"
314 " @classmethod, @property and/or @staticmethod.", 320 " @classmethod, @property and/or @staticmethod.",
315 ), 321 ),
316 "M525": QCoreApplication.translate( 322 "M525": QCoreApplication.translate(
317 "MiscellaneousChecker", 323 "MiscellaneousChecker",
318 "Exception '{0}' has been caught multiple times. Only the first except will be" 324 "Exception '{0}' has been caught multiple times. Only the first except will be"
327 ), 333 ),
328 "M527": QCoreApplication.translate( 334 "M527": QCoreApplication.translate(
329 "MiscellaneousChecker", 335 "MiscellaneousChecker",
330 "{0} is an empty method in an abstract base class, but has no abstract" 336 "{0} is an empty method in an abstract base class, but has no abstract"
331 " decorator. Consider adding @abstractmethod.", 337 " decorator. Consider adding @abstractmethod.",
338 ),
339 "M528": QCoreApplication.translate(
340 "MiscellaneousChecker",
341 "No explicit stacklevel argument found. The warn method from the"
342 " warnings module uses a stacklevel of 1 by default. This will only show a"
343 " stack trace for the line on which the warn method is called."
344 " It is therefore recommended to use a stacklevel of 2 or"
345 " greater to provide more information to the user.",
346 ),
347 "M529":QCoreApplication.translate(
348 "MiscellaneousChecker",
349 "Using 'except ():' with an empty tuple does not handle/catch "
350 "anything. Add exceptions to handle.",
351 ),
352 "M530":QCoreApplication.translate(
353 "MiscellaneousChecker",
354 "Except handlers should only be names of exception classes",
355 ),
356 "M531":QCoreApplication.translate(
357 "MiscellaneousChecker",
358 "Using the generator returned from 'itertools.groupby()' more than once"
359 " will do nothing on the second usage. Save the result to a list, if the"
360 " result is needed multiple times.",
361 ),
362 "M532":QCoreApplication.translate(
363 "MiscellaneousChecker",
364 "Possible unintentional type annotation (using ':'). Did you mean to"
365 " assign (using '=')?",
366 ),
367 "M533":QCoreApplication.translate(
368 "MiscellaneousChecker",
369 "Sets should not contain duplicate items. Duplicate items will be replaced"
370 " with a single item at runtime.",
332 ), 371 ),
333 "M581": QCoreApplication.translate("MiscellaneousChecker", "unncessary f-string"), 372 "M581": QCoreApplication.translate("MiscellaneousChecker", "unncessary f-string"),
334 "M582": QCoreApplication.translate( 373 "M582": QCoreApplication.translate(
335 "MiscellaneousChecker", 374 "MiscellaneousChecker",
336 "cannot use 'self.__class__' as first argument of 'super()' call", 375 "cannot use 'self.__class__' as first argument of 'super()' call",
452 "M193": ["tuple", "list"], 491 "M193": ["tuple", "list"],
453 "M196": ["list"], 492 "M196": ["list"],
454 "M197": ["tuple", "tuple"], 493 "M197": ["tuple", "tuple"],
455 "M198": ["list", "list"], 494 "M198": ["list", "list"],
456 "M201": ["bar", "foo"], 495 "M201": ["bar", "foo"],
457 "M501": [" as err"],
458 "M507": ["x"], 496 "M507": ["x"],
459 "M513": ["Exception"], 497 "M513": ["Exception"],
460 "M514": ["OSError, IOError", " as err", "OSError"], 498 "M514": ["OSError, IOError", " as err", "OSError"],
461 "M523": ["x"], 499 "M523": ["x"],
462 "M524": ["foobar"], 500 "M524": ["foobar"],

eric ide

mercurial