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

branch
eric7
changeset 10085
b5808c3a9967
parent 10050
3750abc45d5e
child 10098
57479c461170
equal deleted inserted replaced
10084:125166c6b66c 10085:b5808c3a9967
10 """ 10 """
11 11
12 from PyQt6.QtCore import QCoreApplication 12 from PyQt6.QtCore import QCoreApplication
13 13
14 _miscellaneousMessages = { 14 _miscellaneousMessages = {
15 ## Coding line
15 "M101": QCoreApplication.translate( 16 "M101": QCoreApplication.translate(
16 "MiscellaneousChecker", "coding magic comment not found" 17 "MiscellaneousChecker", "coding magic comment not found"
17 ), 18 ),
18 "M102": QCoreApplication.translate( 19 "M102": QCoreApplication.translate(
19 "MiscellaneousChecker", "unknown encoding ({0}) found in coding magic comment" 20 "MiscellaneousChecker", "unknown encoding ({0}) found in coding magic comment"
20 ), 21 ),
22 ## Copyright
21 "M111": QCoreApplication.translate( 23 "M111": QCoreApplication.translate(
22 "MiscellaneousChecker", "copyright notice not present" 24 "MiscellaneousChecker", "copyright notice not present"
23 ), 25 ),
24 "M112": QCoreApplication.translate( 26 "M112": QCoreApplication.translate(
25 "MiscellaneousChecker", "copyright notice contains invalid author" 27 "MiscellaneousChecker", "copyright notice contains invalid author"
26 ), 28 ),
29 ## Shadowed Builtins
27 "M131": QCoreApplication.translate( 30 "M131": QCoreApplication.translate(
28 "MiscellaneousChecker", 31 "MiscellaneousChecker",
29 '"{0}" is a Python builtin and is being shadowed; ' 32 '"{0}" is a Python builtin and is being shadowed; '
30 "consider renaming the variable", 33 "consider renaming the variable",
31 ), 34 ),
32 "M132": QCoreApplication.translate( 35 "M132": QCoreApplication.translate(
33 "MiscellaneousChecker", 36 "MiscellaneousChecker",
34 '"{0}" is used as an argument and thus shadows a ' 37 '"{0}" is used as an argument and thus shadows a '
35 "Python builtin; consider renaming the argument", 38 "Python builtin; consider renaming the argument",
36 ), 39 ),
40 ## Comprehensions
37 "M181": QCoreApplication.translate( 41 "M181": QCoreApplication.translate(
38 "MiscellaneousChecker", 42 "MiscellaneousChecker",
39 "unnecessary generator - rewrite as a list comprehension", 43 "unnecessary generator - rewrite as a list comprehension",
40 ), 44 ),
41 "M182": QCoreApplication.translate( 45 "M182": QCoreApplication.translate(
98 ), 102 ),
99 "M198": QCoreApplication.translate( 103 "M198": QCoreApplication.translate(
100 "MiscellaneousChecker", 104 "MiscellaneousChecker",
101 "unnecessary {0} passed to list() - remove the outer call to {1}()", 105 "unnecessary {0} passed to list() - remove the outer call to {1}()",
102 ), 106 ),
107 ## Dictionaries with sorted keys
103 "M201": QCoreApplication.translate( 108 "M201": QCoreApplication.translate(
104 "MiscellaneousChecker", "sort keys - '{0}' should be before '{1}'" 109 "MiscellaneousChecker", "sort keys - '{0}' should be before '{1}'"
105 ), 110 ),
111 ## Property
112 "M210": QCoreApplication.translate(
113 "MiscellaneousChecker",
114 "the number of arguments for property getter method is wrong"
115 " (should be 1 instead of {0})",
116 ),
117 "M211": QCoreApplication.translate(
118 "MiscellaneousChecker",
119 "the number of arguments for property setter method is wrong"
120 " (should be 2 instead of {0})",
121 ),
122 "M212": QCoreApplication.translate(
123 "MiscellaneousChecker",
124 "the number of arguments for property deleter method is wrong"
125 " (should be 1 instead of {0})",
126 ),
127 "M213": QCoreApplication.translate(
128 "MiscellaneousChecker",
129 "the name of the setter method is wrong (should be '{0}' instead of '{1}'",
130 ),
131 "M214": QCoreApplication.translate(
132 "MiscellaneousChecker",
133 "the name of the deleter method is wrong (should be '{0}' instead of '{1}'",
134 ),
135 "M215": QCoreApplication.translate(
136 "MiscellaneousChecker",
137 "the name of the setter decorator is wrong (should be '{0}' instead of '{1}'",
138 ),
139 "M216": QCoreApplication.translate(
140 "MiscellaneousChecker",
141 "the name of the deleter decorator is wrong (should be '{0}' instead of '{1}'",
142 ),
143 "M217": QCoreApplication.translate(
144 "MiscellaneousChecker",
145 "multiple decorators were used to declare property '{0}'",
146 ),
147 ## Naive datetime usage
106 "M301": QCoreApplication.translate( 148 "M301": QCoreApplication.translate(
107 "MiscellaneousChecker", 149 "MiscellaneousChecker",
108 "use of 'datetime.datetime()' without 'tzinfo' argument should be avoided", 150 "use of 'datetime.datetime()' without 'tzinfo' argument should be avoided",
109 ), 151 ),
110 "M302": QCoreApplication.translate( 152 "M302": QCoreApplication.translate(
164 ), 206 ),
165 "M321": QCoreApplication.translate( 207 "M321": QCoreApplication.translate(
166 "MiscellaneousChecker", 208 "MiscellaneousChecker",
167 "use of 'datetime.time()' without 'tzinfo' argument should be avoided", 209 "use of 'datetime.time()' without 'tzinfo' argument should be avoided",
168 ), 210 ),
211 ## sys.version and sys.version_info usage
169 "M401": QCoreApplication.translate( 212 "M401": QCoreApplication.translate(
170 "MiscellaneousChecker", 213 "MiscellaneousChecker",
171 "'sys.version[:3]' referenced (Python 3.10), use 'sys.version_info'", 214 "'sys.version[:3]' referenced (Python 3.10), use 'sys.version_info'",
172 ), 215 ),
173 "M402": QCoreApplication.translate( 216 "M402": QCoreApplication.translate(
205 ), 248 ),
206 "M423": QCoreApplication.translate( 249 "M423": QCoreApplication.translate(
207 "MiscellaneousChecker", 250 "MiscellaneousChecker",
208 "'sys.version[:1]' referenced (Python 10), use 'sys.version_info'", 251 "'sys.version[:1]' referenced (Python 10), use 'sys.version_info'",
209 ), 252 ),
253 ## Bugbear
210 "M501": QCoreApplication.translate( 254 "M501": QCoreApplication.translate(
211 "MiscellaneousChecker", 255 "MiscellaneousChecker",
212 "Do not use bare 'except:', it also catches unexpected events like memory" 256 "Do not use bare 'except:', it also catches unexpected events like memory"
213 " errors, interrupts, system exit, and so on. Prefer 'except Exception:'." 257 " errors, interrupts, system exit, and so on. Prefer 'except Exception:'."
214 " If you're sure what you're doing, be explicit and write" 258 " If you're sure what you're doing, be explicit and write"
367 "M533": QCoreApplication.translate( 411 "M533": QCoreApplication.translate(
368 "MiscellaneousChecker", 412 "MiscellaneousChecker",
369 "Sets should not contain duplicate items. Duplicate items will be replaced" 413 "Sets should not contain duplicate items. Duplicate items will be replaced"
370 " with a single item at runtime.", 414 " with a single item at runtime.",
371 ), 415 ),
416 ## Bugbear++
372 "M581": QCoreApplication.translate("MiscellaneousChecker", "unncessary f-string"), 417 "M581": QCoreApplication.translate("MiscellaneousChecker", "unncessary f-string"),
373 "M582": QCoreApplication.translate( 418 "M582": QCoreApplication.translate(
374 "MiscellaneousChecker", 419 "MiscellaneousChecker",
375 "cannot use 'self.__class__' as first argument of 'super()' call", 420 "cannot use 'self.__class__' as first argument of 'super()' call",
376 ), 421 ),
422 ## Format Strings
377 "M601": QCoreApplication.translate("MiscellaneousChecker", "found {0} formatter"), 423 "M601": QCoreApplication.translate("MiscellaneousChecker", "found {0} formatter"),
378 "M611": QCoreApplication.translate( 424 "M611": QCoreApplication.translate(
379 "MiscellaneousChecker", "format string does contain unindexed parameters" 425 "MiscellaneousChecker", "format string does contain unindexed parameters"
380 ), 426 ),
381 "M612": QCoreApplication.translate( 427 "M612": QCoreApplication.translate(
406 "MiscellaneousChecker", "format call provides unused index ({0})" 452 "MiscellaneousChecker", "format call provides unused index ({0})"
407 ), 453 ),
408 "M632": QCoreApplication.translate( 454 "M632": QCoreApplication.translate(
409 "MiscellaneousChecker", "format call provides unused keyword ({0})" 455 "MiscellaneousChecker", "format call provides unused keyword ({0})"
410 ), 456 ),
457 ## Logging
411 "M651": QCoreApplication.translate( 458 "M651": QCoreApplication.translate(
412 "MiscellaneousChecker", "logging statement uses string.format()" 459 "MiscellaneousChecker", "logging statement uses string.format()"
413 ), 460 ),
414 "M652": QCoreApplication.translate( 461 "M652": QCoreApplication.translate(
415 "MiscellaneousChecker", "logging statement uses '%'" # __IGNORE_WARNING_M601__ 462 "MiscellaneousChecker", "logging statement uses '%'" # __IGNORE_WARNING_M601__
421 "MiscellaneousChecker", "logging statement uses f-string" 468 "MiscellaneousChecker", "logging statement uses f-string"
422 ), 469 ),
423 "M655": QCoreApplication.translate( 470 "M655": QCoreApplication.translate(
424 "MiscellaneousChecker", "logging statement uses 'warn' instead of 'warning'" 471 "MiscellaneousChecker", "logging statement uses 'warn' instead of 'warning'"
425 ), 472 ),
473 ## Future statements
426 "M701": QCoreApplication.translate( 474 "M701": QCoreApplication.translate(
427 "MiscellaneousChecker", 475 "MiscellaneousChecker",
428 "expected these __future__ imports: {0}; but only got: {1}", 476 "expected these __future__ imports: {0}; but only got: {1}",
429 ), 477 ),
430 "M702": QCoreApplication.translate( 478 "M702": QCoreApplication.translate(
431 "MiscellaneousChecker", "expected these __future__ imports: {0}; but got none" 479 "MiscellaneousChecker", "expected these __future__ imports: {0}; but got none"
432 ), 480 ),
481 ## Gettext
433 "M711": QCoreApplication.translate( 482 "M711": QCoreApplication.translate(
434 "MiscellaneousChecker", "gettext import with alias _ found: {0}" 483 "MiscellaneousChecker", "gettext import with alias _ found: {0}"
435 ), 484 ),
485 ##~ print() statements
436 "M801": QCoreApplication.translate("MiscellaneousChecker", "print statement found"), 486 "M801": QCoreApplication.translate("MiscellaneousChecker", "print statement found"),
487 ## one element tuple
437 "M811": QCoreApplication.translate( 488 "M811": QCoreApplication.translate(
438 "MiscellaneousChecker", "one element tuple found" 489 "MiscellaneousChecker", "one element tuple found"
439 ), 490 ),
491 ## Mutable Defaults
440 "M821": QCoreApplication.translate( 492 "M821": QCoreApplication.translate(
441 "MiscellaneousChecker", "mutable default argument of type {0}" 493 "MiscellaneousChecker", "mutable default argument of type {0}"
442 ), 494 ),
443 "M822": QCoreApplication.translate( 495 "M822": QCoreApplication.translate(
444 "MiscellaneousChecker", "mutable default argument of type {0}" 496 "MiscellaneousChecker", "mutable default argument of type {0}"
445 ), 497 ),
446 "M823": QCoreApplication.translate( 498 "M823": QCoreApplication.translate(
447 "MiscellaneousChecker", "mutable default argument of function call '{0}'" 499 "MiscellaneousChecker", "mutable default argument of function call '{0}'"
448 ), 500 ),
501 ##~ return statements
449 "M831": QCoreApplication.translate( 502 "M831": QCoreApplication.translate(
450 "MiscellaneousChecker", 503 "MiscellaneousChecker",
451 "None should not be added at any return if function has no return" 504 "None should not be added at any return if function has no return"
452 " value except None", 505 " value except None",
453 ), 506 ),
464 "M834": QCoreApplication.translate( 517 "M834": QCoreApplication.translate(
465 "MiscellaneousChecker", 518 "MiscellaneousChecker",
466 "a value should not be assigned to a variable if it will be used as a" 519 "a value should not be assigned to a variable if it will be used as a"
467 " return value only", 520 " return value only",
468 ), 521 ),
522 ## line continuation
469 "M841": QCoreApplication.translate( 523 "M841": QCoreApplication.translate(
470 "MiscellaneousChecker", 524 "MiscellaneousChecker",
471 "prefer implied line continuation inside parentheses, " 525 "prefer implied line continuation inside parentheses, "
472 "brackets and braces as opposed to a backslash", 526 "brackets and braces as opposed to a backslash",
473 ), 527 ),
528 ## commented code
474 "M891": QCoreApplication.translate( 529 "M891": QCoreApplication.translate(
475 "MiscellaneousChecker", "commented code lines should be removed" 530 "MiscellaneousChecker", "commented code lines should be removed"
476 ), 531 ),
477 } 532 }
478 533
491 "M193": ["tuple", "list"], 546 "M193": ["tuple", "list"],
492 "M196": ["list"], 547 "M196": ["list"],
493 "M197": ["tuple", "tuple"], 548 "M197": ["tuple", "tuple"],
494 "M198": ["list", "list"], 549 "M198": ["list", "list"],
495 "M201": ["bar", "foo"], 550 "M201": ["bar", "foo"],
551 "M210": [2],
552 "M211": [1],
553 "M212": [2],
554 "M213": ["foo", "bar"],
555 "M214": ["foo", "bar"],
556 "M215": ["foo", "bar"],
557 "M216": ["foo", "bar"],
558 "M217": ["foo"],
496 "M507": ["x"], 559 "M507": ["x"],
497 "M513": ["Exception"], 560 "M513": ["Exception"],
498 "M514": ["OSError, IOError", " as err", "OSError"], 561 "M514": ["OSError, IOError", " as err", "OSError"],
499 "M523": ["x"], 562 "M523": ["x"],
500 "M524": ["foobar"], 563 "M524": ["foobar"],

eric ide

mercurial