]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/Python/Ecc/EccToolError.py
Sync EDKII BaseTools to BaseTools project r1903.
[mirror_edk2.git] / BaseTools / Source / Python / Ecc / EccToolError.py
CommitLineData
30fdf114
LG
1## @file\r
2# Standardized Error Hanlding infrastructures.\r
3#\r
52302d4d 4# Copyright (c) 2008 - 2010, Intel Corporation\r
30fdf114
LG
5# All rights reserved. This program and the accompanying materials\r
6# are licensed and made available under the terms and conditions of the BSD License\r
7# which accompanies this distribution. The full text of the license may be found at\r
8# http://opensource.org/licenses/bsd-license.php\r
9#\r
10# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12#\r
13\r
14ERROR_GENERAL_CHECK_ALL = 1000\r
15ERROR_GENERAL_CHECK_NO_TAB = 1001\r
16ERROR_GENERAL_CHECK_INDENTATION = 1002\r
17ERROR_GENERAL_CHECK_LINE = 1003\r
18ERROR_GENERAL_CHECK_NO_ASM = 1004\r
19ERROR_GENERAL_CHECK_NO_PROGMA = 1005\r
20ERROR_GENERAL_CHECK_CARRIAGE_RETURN = 1006\r
21ERROR_GENERAL_CHECK_FILE_EXISTENCE = 1007\r
22\r
23ERROR_SPACE_CHECK_ALL = 2000\r
24\r
25ERROR_PREDICATE_EXPRESSION_CHECK_ALL = 3000\r
26ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE = 3001\r
27ERROR_PREDICATE_EXPRESSION_CHECK_NO_BOOLEAN_OPERATOR = 3002\r
28ERROR_PREDICATE_EXPRESSION_CHECK_COMPARISON_NULL_TYPE = 3003\r
29\r
30ERROR_HEADER_CHECK_ALL = 4000\r
31ERROR_HEADER_CHECK_FILE = 4001\r
32ERROR_HEADER_CHECK_FUNCTION = 4002\r
33\r
34ERROR_C_FUNCTION_LAYOUT_CHECK_ALL = 5000\r
35ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE = 5001\r
36ERROR_C_FUNCTION_LAYOUT_CHECK_OPTIONAL_FUNCTIONAL_MODIFIER = 5002\r
37ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_NAME = 5003\r
38ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE = 5004\r
39ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY = 5005\r
40ERROR_C_FUNCTION_LAYOUT_CHECK_DATA_DECLARATION = 5006\r
41ERROR_C_FUNCTION_LAYOUT_CHECK_NO_INIT_OF_VARIABLE = 5007\r
42ERROR_C_FUNCTION_LAYOUT_CHECK_NO_STATIC = 5008\r
52302d4d
LG
43ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_2 = 5009\r
44ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_3 = 5010\r
30fdf114
LG
45\r
46ERROR_INCLUDE_FILE_CHECK_ALL = 6000\r
47ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_1 = 6001\r
48ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_2 = 6002\r
49ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_3 = 6003\r
50ERROR_INCLUDE_FILE_CHECK_DATA = 6004\r
51ERROR_INCLUDE_FILE_CHECK_NAME = 6005\r
52\r
53ERROR_DECLARATION_DATA_TYPE_CHECK_ALL = 7000\r
54ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE = 7001\r
55ERROR_DECLARATION_DATA_TYPE_CHECK_IN_OUT_MODIFIER = 7002\r
56ERROR_DECLARATION_DATA_TYPE_CHECK_EFI_API_MODIFIER = 7003\r
57ERROR_DECLARATION_DATA_TYPE_CHECK_ENUMERATED_TYPE = 7004\r
58ERROR_DECLARATION_DATA_TYPE_CHECK_STRUCTURE_DECLARATION = 7005\r
59ERROR_DECLARATION_DATA_TYPE_CHECK_SAME_STRUCTURE = 7007\r
60ERROR_DECLARATION_DATA_TYPE_CHECK_UNION_TYPE = 7006\r
61ERROR_DECLARATION_DATA_TYPE_CHECK_NESTED_STRUCTURE = 7008\r
62\r
63ERROR_NAMING_CONVENTION_CHECK_ALL = 8000\r
64ERROR_NAMING_CONVENTION_CHECK_DEFINE_STATEMENT = 8001\r
65ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT = 8002\r
66ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT = 8003\r
67ERROR_NAMING_CONVENTION_CHECK_PATH_NAME = 8004\r
68ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME = 8005\r
69ERROR_NAMING_CONVENTION_CHECK_FUNCTION_NAME = 8006\r
70ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE = 8007\r
71\r
72ERROR_DOXYGEN_CHECK_ALL = 9000\r
73ERROR_DOXYGEN_CHECK_FILE_HEADER = 9001\r
74ERROR_DOXYGEN_CHECK_FUNCTION_HEADER = 9002\r
75ERROR_DOXYGEN_CHECK_COMMENT_DESCRIPTION = 9003\r
76ERROR_DOXYGEN_CHECK_COMMENT_FORMAT = 9004\r
77ERROR_DOXYGEN_CHECK_COMMAND = 9005\r
78\r
79ERROR_META_DATA_FILE_CHECK_ALL = 10000\r
80ERROR_META_DATA_FILE_CHECK_PATH_NAME = 10001\r
81ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1 = 10002\r
82ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_2 = 10003\r
83ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT = 10004\r
84ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_ORDER = 10005\r
85ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE = 10006\r
86ERROR_META_DATA_FILE_CHECK_BINARY_INF_IN_FDF = 10007\r
87ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE = 10008\r
88ERROR_META_DATA_FILE_CHECK_PCD_FLASH = 10009\r
89ERROR_META_DATA_FILE_CHECK_PCD_NO_USE = 10010\r
90ERROR_META_DATA_FILE_CHECK_DUPLICATE_GUID = 10011\r
91ERROR_META_DATA_FILE_CHECK_DUPLICATE_PROTOCOL = 10012\r
92ERROR_META_DATA_FILE_CHECK_DUPLICATE_PPI = 10013\r
93ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE = 10014\r
94ERROR_META_DATA_FILE_CHECK_PCD_TYPE = 10015\r
95\r
96ERROR_SPELLING_CHECK_ALL = 11000\r
97\r
98gEccErrorMessage = {\r
99 ERROR_GENERAL_CHECK_ALL : "",\r
100 ERROR_GENERAL_CHECK_NO_TAB : "'TAB' character is not allowed in source code, please replace each 'TAB' with two spaces",\r
101 ERROR_GENERAL_CHECK_INDENTATION : "Indentation does not follow coding style",\r
102 ERROR_GENERAL_CHECK_LINE : "The width of each line does not follow coding style",\r
103 ERROR_GENERAL_CHECK_NO_ASM : "There should be no use of _asm in the source file",\r
104 ERROR_GENERAL_CHECK_NO_PROGMA : """There should be no use of "#progma" in source file except "#pragma pack(#)\"""",\r
105 ERROR_GENERAL_CHECK_CARRIAGE_RETURN : "There should be a carriage return at the end of the file",\r
106 ERROR_GENERAL_CHECK_FILE_EXISTENCE : "File not found",\r
52302d4d 107\r
30fdf114 108 ERROR_SPACE_CHECK_ALL : "",\r
52302d4d 109\r
30fdf114
LG
110 ERROR_PREDICATE_EXPRESSION_CHECK_ALL : "",\r
111 ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE : "Boolean values and variable type BOOLEAN should not use explicit comparisons to TRUE or FALSE",\r
112 ERROR_PREDICATE_EXPRESSION_CHECK_NO_BOOLEAN_OPERATOR : "Non-Boolean comparisons should use a compare operator (==, !=, >, < >=, <=)",\r
113 ERROR_PREDICATE_EXPRESSION_CHECK_COMPARISON_NULL_TYPE : "A comparison of any pointer to zero must be done via the NULL type",\r
52302d4d 114\r
30fdf114
LG
115 ERROR_HEADER_CHECK_ALL : "",\r
116 ERROR_HEADER_CHECK_FILE : "File header doesn't exist",\r
117 ERROR_HEADER_CHECK_FUNCTION : "Function header doesn't exist",\r
52302d4d 118\r
30fdf114
LG
119 ERROR_C_FUNCTION_LAYOUT_CHECK_ALL : "",\r
120 ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE : "Return type of a function should exist and in the first line",\r
121 ERROR_C_FUNCTION_LAYOUT_CHECK_OPTIONAL_FUNCTIONAL_MODIFIER : "Any optional functional modifiers should exist and next to the return type",\r
122 ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_NAME : """Function name should be left justified, followed by the beginning of the parameter list, with the closing parenthesis on its own line, indented two spaces""",\r
123 ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE : "Function prototypes in include files have the same form as function definitions",\r
52302d4d
LG
124 ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_2 : "Function prototypes in include files have different parameter number with function definitions",\r
125 ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_3 : "Function prototypes in include files have different parameter modifier with function definitions",\r
30fdf114
LG
126 ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY : "The body of a function should be contained by open and close braces that must be in the first column",\r
127 ERROR_C_FUNCTION_LAYOUT_CHECK_DATA_DECLARATION : "The data declarations should be the first code in a module",\r
128 ERROR_C_FUNCTION_LAYOUT_CHECK_NO_INIT_OF_VARIABLE : "There should be no initialization of a variable as part of its declaration",\r
129 ERROR_C_FUNCTION_LAYOUT_CHECK_NO_STATIC : "There should be no use of STATIC for functions",\r
52302d4d 130\r
30fdf114
LG
131 ERROR_INCLUDE_FILE_CHECK_ALL : "",\r
132 ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_1 : "All include file contents should be guarded by a #ifndef statement.",\r
133 ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_2 : "The #ifndef must be the first line of code following the file header comment",\r
134 ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_3 : "The #endif must appear on the last line in the file",\r
135 ERROR_INCLUDE_FILE_CHECK_DATA : "Include files should contain only public or only private data and cannot contain code or define data variables",\r
136 ERROR_INCLUDE_FILE_CHECK_NAME : "No permission for the inlcude file with same names",\r
52302d4d 137\r
30fdf114
LG
138 ERROR_DECLARATION_DATA_TYPE_CHECK_ALL : "",\r
139 ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE : "There should be no use of int, unsigned, char, void, static, long in any .c, .h or .asl files",\r
140 ERROR_DECLARATION_DATA_TYPE_CHECK_IN_OUT_MODIFIER : """The modifiers IN, OUT, OPTIONAL, and UNALIGNED should be used only to qualify arguments to a function and should not appear in a data type declaration""",\r
141 ERROR_DECLARATION_DATA_TYPE_CHECK_EFI_API_MODIFIER : "The EFIAPI modifier should be used at the entry of drivers, events, and member functions of protocols",\r
142 ERROR_DECLARATION_DATA_TYPE_CHECK_ENUMERATED_TYPE : "Enumerated Type should have a 'typedef' and the name must be in capital letters",\r
143 ERROR_DECLARATION_DATA_TYPE_CHECK_STRUCTURE_DECLARATION : "Structure Type should have a 'typedef' and the name must be in capital letters",\r
144 ERROR_DECLARATION_DATA_TYPE_CHECK_SAME_STRUCTURE : "No permission for the structure with same names",\r
145 ERROR_DECLARATION_DATA_TYPE_CHECK_UNION_TYPE : "Union Type should have a 'typedef' and the name must be in capital letters",\r
146 ERROR_DECLARATION_DATA_TYPE_CHECK_NESTED_STRUCTURE : "Complex types should be typedef-ed",\r
52302d4d 147\r
30fdf114
LG
148 ERROR_NAMING_CONVENTION_CHECK_ALL : "",\r
149 ERROR_NAMING_CONVENTION_CHECK_DEFINE_STATEMENT : "Only capital letters are allowed to be used for #define declarations",\r
150 ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT : "Only capital letters are allowed to be used for typedef declarations",\r
151 ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT : "The #ifndef at the start of an include file should use both prefix and postfix underscore characters, '_'",\r
152 ERROR_NAMING_CONVENTION_CHECK_PATH_NAME : """Path name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters""",\r
153 ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME : """Variable name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters 4. Global variable name must start with a 'g'""",\r
154 ERROR_NAMING_CONVENTION_CHECK_FUNCTION_NAME : """Function name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters""",\r
155 ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE : "There should be no use of short (single character) variable names",\r
52302d4d 156\r
30fdf114
LG
157 ERROR_DOXYGEN_CHECK_ALL : "",\r
158 ERROR_DOXYGEN_CHECK_FILE_HEADER : "The file headers should follow Doxygen special documentation blocks in section 2.3.5",\r
159 ERROR_DOXYGEN_CHECK_FUNCTION_HEADER : "The function headers should follow Doxygen special documentation blocks in section 2.3.5",\r
160 ERROR_DOXYGEN_CHECK_COMMENT_DESCRIPTION : """The first line of text in a comment block should be a brief description of the element being documented and the brief description must end with a period.""",\r
161 ERROR_DOXYGEN_CHECK_COMMENT_FORMAT : "For comment line with '///< ... text ...' format, if it is used, it should be after the code section",\r
52302d4d
LG
162 ERROR_DOXYGEN_CHECK_COMMAND : "Only Doxygen commands '@bug', '@todo', '@example', '@file', '@attention', '@param', '@post', '@pre', '@retval', '@return', '@sa', '@since', '@test', '@note', '@par' are allowed to mark the code",\r
163\r
30fdf114
LG
164 ERROR_META_DATA_FILE_CHECK_ALL : "",\r
165 ERROR_META_DATA_FILE_CHECK_PATH_NAME : "The file defined in meta-data does not exist",\r
52302d4d 166 ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1 : "A library instances defined for a given module (or dependent library instance) doesn't match the module's type.",\r
30fdf114
LG
167 ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_2 : "A library instance must specify the Supported Module Types in its INF file",\r
168 ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT : "A library instance must be defined for all dependent library classes",\r
169 ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_ORDER : "The library Instances specified by the LibraryClasses sections should be listed in order of dependencies",\r
170 ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE : "There should be no unnecessary inclusion of library classes in the INF file",\r
171 ERROR_META_DATA_FILE_CHECK_BINARY_INF_IN_FDF : "An INF file is specified in the FDF file, but not in the DSC file, therefore the INF file must be for a Binary module only",\r
172 ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE : "Duplicate PCDs found",\r
173 ERROR_META_DATA_FILE_CHECK_PCD_FLASH : "PCD settings in the FDF file should only be related to flash",\r
174 ERROR_META_DATA_FILE_CHECK_PCD_NO_USE : "There should be no PCDs declared in INF files that are not specified in in either a DSC or FDF file",\r
175 ERROR_META_DATA_FILE_CHECK_DUPLICATE_GUID : "Duplicate GUID found",\r
176 ERROR_META_DATA_FILE_CHECK_DUPLICATE_PROTOCOL : "Duplicate PROTOCOL found",\r
177 ERROR_META_DATA_FILE_CHECK_DUPLICATE_PPI : "Duplicate PPI found",\r
52302d4d 178 ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE : "No used module files found",\r
30fdf114 179 ERROR_META_DATA_FILE_CHECK_PCD_TYPE : "Wrong C code function used for this kind of PCD",\r
52302d4d 180\r
30fdf114
LG
181 ERROR_SPELLING_CHECK_ALL : "",\r
182 }\r
183\r