eric6/Plugins/CheckerPlugins/CodeStyleChecker/translations.py

changeset 7782
976d3b19ba7f
parent 7780
41420f82c0ac
child 7784
3257703e10c5
equal deleted inserted replaced
7781:607a6098cb44 7782:976d3b19ba7f
9 9
10 from PyQt5.QtCore import QCoreApplication 10 from PyQt5.QtCore import QCoreApplication
11 11
12 from .Security.translations import ( 12 from .Security.translations import (
13 _securityMessages, _securityMessagesSampleArgs 13 _securityMessages, _securityMessagesSampleArgs
14 )
15 from .Annotations.translations import (
16 _annotationsMessages, _annotationsMessagesSampleArgs
17 )
18 from .Complexity.translations import (
19 _complexityMessages, _complexityMessagesSampleArgs
14 ) 20 )
15 21
16 # TODO: separate this huge dict into separate translations per checker type 22 # TODO: separate this huge dict into separate translations per checker type
17 _messages = { 23 _messages = {
18 ################################################################## 24 ##################################################################
469 "N831": QCoreApplication.translate( 475 "N831": QCoreApplication.translate(
470 "NamingStyleChecker", 476 "NamingStyleChecker",
471 "names 'l', 'O' and 'I' should be avoided"), 477 "names 'l', 'O' and 'I' should be avoided"),
472 478
473 ################################################################## 479 ##################################################################
474 ## Code complexity messages
475 ##################################################################
476 "C101": QCoreApplication.translate(
477 "ComplexityChecker", "'{0}' is too complex ({1})"),
478 "C111": QCoreApplication.translate(
479 "ComplexityChecker", "source code line is too complex ({0})"),
480 "C112": QCoreApplication.translate(
481 "ComplexityChecker",
482 "overall source code line complexity is too high ({0})"),
483 "C901": QCoreApplication.translate(
484 "ComplexityChecker", "{0}: {1}"),
485
486 ##################################################################
487 ## Messages of the Miscellaneous Checker 480 ## Messages of the Miscellaneous Checker
488 ################################################################## 481 ##################################################################
489 "M101": QCoreApplication.translate( 482 "M101": QCoreApplication.translate(
490 "MiscellaneousChecker", 483 "MiscellaneousChecker",
491 "coding magic comment not found"), 484 "coding magic comment not found"),
794 "MiscellaneousChecker", 787 "MiscellaneousChecker",
795 "commented code lines should be removed"), 788 "commented code lines should be removed"),
796 789
797 "M901": QCoreApplication.translate( 790 "M901": QCoreApplication.translate(
798 "MiscellaneousChecker", 791 "MiscellaneousChecker",
799 "{0}: {1}"),
800
801
802 ##################################################################
803 ## Messages of the Annotations Checker
804 ##################################################################
805 "A001": QCoreApplication.translate(
806 "AnnotationsChecker",
807 "missing type annotation for function argument '{0}'"),
808 "A002": QCoreApplication.translate(
809 "AnnotationsChecker",
810 "missing type annotation for '*{0}'"),
811 "A003": QCoreApplication.translate(
812 "AnnotationsChecker",
813 "missing type annotation for '**{0}'"),
814 "A101": QCoreApplication.translate(
815 "AnnotationsChecker",
816 "missing type annotation for 'self' in method"),
817 "A102": QCoreApplication.translate(
818 "AnnotationsChecker",
819 "missing type annotation for 'cls' in classmethod"),
820 "A201": QCoreApplication.translate(
821 "AnnotationsChecker",
822 "missing return type annotation for public function"),
823 "A202": QCoreApplication.translate(
824 "AnnotationsChecker",
825 "missing return type annotation for protected function"),
826 "A203": QCoreApplication.translate(
827 "AnnotationsChecker",
828 "missing return type annotation for private function"),
829 "A204": QCoreApplication.translate(
830 "AnnotationsChecker",
831 "missing return type annotation for special method"),
832 "A205": QCoreApplication.translate(
833 "AnnotationsChecker",
834 "missing return type annotation for staticmethod"),
835 "A206": QCoreApplication.translate(
836 "AnnotationsChecker",
837 "missing return type annotation for classmethod"),
838
839 "A881": QCoreApplication.translate(
840 "AnnotationsChecker",
841 "type annotation coverage of {0}% is too low"),
842
843 "A891": QCoreApplication.translate(
844 "AnnotationsChecker",
845 "type annotation is too complex ({0} > {1})"),
846
847 "A999": QCoreApplication.translate(
848 "AnnotationsChecker",
849 "{0}: {1}"), 792 "{0}: {1}"),
850 793
851 ################################################################## 794 ##################################################################
852 ## CodeStyleFixer messages 795 ## CodeStyleFixer messages
853 ################################################################## 796 ##################################################################
1032 "D253": ["RuntimeError"], 975 "D253": ["RuntimeError"],
1033 "D262": ["buttonClicked"], 976 "D262": ["buttonClicked"],
1034 "D263": ["buttonClicked"], 977 "D263": ["buttonClicked"],
1035 "D901": ["SyntaxError", "Invalid Syntax"], 978 "D901": ["SyntaxError", "Invalid Syntax"],
1036 979
1037 "C101": ["foo.bar", "42"],
1038 "C111": [42],
1039 "C112": [12.0],
1040 "C901": ["SyntaxError", "Invalid Syntax"],
1041
1042 "M102": ["enc42"], 980 "M102": ["enc42"],
1043 "M131": ["list"], 981 "M131": ["list"],
1044 "M132": ["list"], 982 "M132": ["list"],
1045 "M188": ["sorted"], 983 "M188": ["sorted"],
1046 "M186": ["list"], 984 "M186": ["list"],
1062 "M821": ["Dict"], 1000 "M821": ["Dict"],
1063 "M822": ["Call"], 1001 "M822": ["Call"],
1064 "M823": ["dict"], 1002 "M823": ["dict"],
1065 "M901": ["SyntaxError", "Invalid Syntax"], 1003 "M901": ["SyntaxError", "Invalid Syntax"],
1066 1004
1067 "A001": ["arg1"],
1068 "A002": ["args"],
1069 "A003": ["kwargs"],
1070 "A881": [60],
1071 "A891": [5, 3],
1072 "A999": ["SyntaxError", "Invalid Syntax"],
1073
1074 "FIXWRITE_ERROR": ["IOError"], 1005 "FIXWRITE_ERROR": ["IOError"],
1075 } 1006 }
1076 1007
1077 messageCatalogs = ( 1008 messageCatalogs = (
1078 _messages, 1009 _messages,
1079 _securityMessages, 1010 _securityMessages,
1011 _annotationsMessages,
1012 _complexityMessages,
1080 ) 1013 )
1081 1014
1082 messageSampleArgsCatalog = ( 1015 messageSampleArgsCatalog = (
1083 _messages_sample_args, 1016 _messages_sample_args,
1084 _securityMessagesSampleArgs, 1017 _securityMessagesSampleArgs,
1018 _annotationsMessagesSampleArgs,
1019 _complexityMessagesSampleArgs,
1085 ) 1020 )
1086 1021
1087 1022
1088 def getTranslatedMessage(messageCode, messageArgs, example=False): 1023 def getTranslatedMessage(messageCode, messageArgs, example=False):
1089 """ 1024 """

eric ide

mercurial