## @file\r
# This file is used to define class Configuration\r
#\r
-# Copyright (c) 2008, Intel Corporation\r
-# All rights reserved. This program and the accompanying materials\r
+# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
# http://opensource.org/licenses/bsd-license.php\r
##\r
# Import Modules\r
#\r
-import os\r
+import Common.LongFilePathOs as os\r
import Common.EdkLogger as EdkLogger\r
from Common.DataType import *\r
from Common.String import *\r
+from Common.LongFilePathSupport import OpenLongFilePath as open\r
\r
## Configuration\r
#\r
class Configuration(object):\r
def __init__(self, Filename):\r
self.Filename = Filename\r
- \r
+\r
self.Version = 0.1\r
\r
## Identify to if check all items\r
# SpaceCheckAll\r
#\r
self.AutoCorrect = 0\r
- \r
+\r
# List customized Modifer here, split with ','\r
# Defaultly use the definition in class DataType\r
self.ModifierList = MODIFIER_LIST\r
- \r
+\r
## General Checking\r
self.GeneralCheckAll = 0\r
- \r
+\r
# Check whether NO Tab is used, replaced with spaces\r
self.GeneralCheckNoTab = 1\r
# The width of Tab\r
self.GeneralCheckCarriageReturn = 1\r
# Check whether the file exists\r
self.GeneralCheckFileExistence = 1\r
- \r
+ # Check whether file has non ACSII char\r
+ self.GeneralCheckNonAcsii = 1\r
+ # Check whether UNI file is valid\r
+ self.GeneralCheckUni = 1\r
+\r
## Space Checking\r
self.SpaceCheckAll = 1\r
- \r
+\r
## Predicate Expression Checking\r
self.PredicateExpressionCheckAll = 0\r
- \r
+\r
# Check whether Boolean values, variable type BOOLEAN not use explicit comparisons to TRUE or FALSE\r
self.PredicateExpressionCheckBooleanValue = 1\r
- # Check whether Non-Boolean comparisons use a compare operator (==, !=, >, < >=, <=). \r
+ # Check whether Non-Boolean comparisons use a compare operator (==, !=, >, < >=, <=).\r
self.PredicateExpressionCheckNonBooleanOperator = 1\r
# Check whether a comparison of any pointer to zero must be done via the NULL type\r
self.PredicateExpressionCheckComparisonNullType = 1\r
- \r
+\r
## Headers Checking\r
self.HeaderCheckAll = 0\r
- \r
+\r
# Check whether File header exists\r
self.HeaderCheckFile = 1\r
# Check whether Function header exists\r
self.HeaderCheckFunction = 1\r
- \r
+ # Check whether Meta data File header Comment End with '##'\r
+ self.HeaderCheckFileCommentEnd = 1\r
+ # Check whether C File header Comment content start with two spaces\r
+ self.HeaderCheckCFileCommentStartSpacesNum = 1\r
+ # Check whether C File header Comment's each reference at list should begin with a bullet character '-'\r
+ self.HeaderCheckCFileCommentReferenceFormat = 1\r
+ # Check whether C File header Comment have the License immediately after the ""Copyright"" line\r
+ self.HeaderCheckCFileCommentLicenseFormat = 1\r
+ \r
## C Function Layout Checking\r
self.CFunctionLayoutCheckAll = 0\r
- \r
+\r
# Check whether return type exists and in the first line\r
self.CFunctionLayoutCheckReturnType = 1\r
# Check whether any optional functional modifiers exist and next to the return type\r
self.CFunctionLayoutCheckNoInitOfVariable = 1\r
# Check whether no use of STATIC for functions\r
self.CFunctionLayoutCheckNoStatic = 1\r
- \r
+\r
## Include Files Checking\r
self.IncludeFileCheckAll = 0\r
- \r
+\r
#Check whether having include files with same name\r
self.IncludeFileCheckSameName = 1\r
# Check whether all include file contents is guarded by a #ifndef statement.\r
# Check whether include files contain only public or only private data\r
# Check whether include files NOT contain code or define data variables\r
self.IncludeFileCheckData = 1\r
- \r
+\r
## Declarations and Data Types Checking\r
self.DeclarationDataTypeCheckAll = 0\r
- \r
+\r
# Check whether no use of int, unsigned, char, void, static, long in any .c, .h or .asl files.\r
self.DeclarationDataTypeCheckNoUseCType = 1\r
# Check whether the modifiers IN, OUT, OPTIONAL, and UNALIGNED are used only to qualify arguments to a function and should not appear in a data type declaration\r
self.DeclarationDataTypeCheckSameStructure = 1\r
# Check whether Union Type has a 'typedef' and the name is capital\r
self.DeclarationDataTypeCheckUnionType = 1\r
- \r
+\r
## Naming Conventions Checking\r
self.NamingConventionCheckAll = 0\r
- \r
+\r
# Check whether only capital letters are used for #define declarations\r
self.NamingConventionCheckDefineStatement = 1\r
# Check whether only capital letters are used for typedef declarations\r
self.NamingConventionCheckFunctionName = 1\r
# Check whether NO use short variable name with single character\r
self.NamingConventionCheckSingleCharacterVariable = 1\r
- \r
+\r
## Doxygen Checking\r
self.DoxygenCheckAll = 0\r
- \r
+\r
# Check whether the file headers are followed Doxygen special documentation blocks in section 2.3.5\r
self.DoxygenCheckFileHeader = 1\r
# Check whether the function headers are followed Doxygen special documentation blocks in section 2.3.5\r
self.DoxygenCheckFunctionHeader = 1\r
- # Check whether the first line of text in a comment block is a brief description of the element being documented. \r
+ # Check whether the first line of text in a comment block is a brief description of the element being documented.\r
# The brief description must end with a period.\r
self.DoxygenCheckCommentDescription = 1\r
# Check whether comment lines with '///< ... text ...' format, if it is used, it should be after the code section.\r
self.DoxygenCheckCommentFormat = 1\r
# Check whether only Doxygen commands allowed to mark the code are @bug and @todo.\r
self.DoxygenCheckCommand = 1\r
- \r
+\r
## Meta-Data File Processing Checking\r
self.MetaDataFileCheckAll = 0\r
- \r
+\r
# Check whether each file defined in meta-data exists\r
self.MetaDataFileCheckPathName = 1\r
# Generate a list for all files defined in meta-data files\r
self.MetaDataFileCheckGenerateFileList = 1\r
# The path of log file\r
self.MetaDataFileCheckPathOfGenerateFileList = 'File.log'\r
- # Check whether all Library Instances defined for a given module (or dependent library instance) match the module's type. \r
- # Each Library Instance must specify the Supported Module Types in its INF file, \r
+ # Check whether all Library Instances defined for a given module (or dependent library instance) match the module's type.\r
+ # Each Library Instance must specify the Supported Module Types in its INF file,\r
# and any module specifying the library instance must be one of the supported types.\r
self.MetaDataFileCheckLibraryInstance = 1\r
# Check whether a Library Instance has been defined for all dependent library classes\r
self.MetaDataFileCheckLibraryInstanceOrder = 1\r
# Check whether the unnecessary inclusion of library classes in the INF file\r
self.MetaDataFileCheckLibraryNoUse = 1\r
+ # Check the header file in Include\Library directory whether be defined in the package DEC file.\r
+ self.MetaDataFileCheckLibraryDefinedInDec = 1\r
# Check whether an INF file is specified in the FDF file, but not in the DSC file, then the INF file must be for a Binary module only\r
self.MetaDataFileCheckBinaryInfInFdf = 1\r
# Not to report error and warning related OS include file such as "windows.h" and "stdio.h"\r
self.MetaDataFileCheckModuleFileNoUse = 1\r
# Check whether the PCD is correctly used in C function via its type\r
self.MetaDataFileCheckPcdType = 1\r
+ # Check whether there are FILE_GUID duplication among different INF files\r
+ self.MetaDataFileCheckModuleFileGuidDuplication = 1\r
+\r
+ # Check Guid Format in INF files\r
+ self.MetaDataFileCheckModuleFileGuidFormat = 1\r
+ # Check Protocol Format in INF files\r
+ self.MetaDataFileCheckModuleFileProtocolFormat = 1\r
+ # Check Ppi Format in INF files\r
+ self.MetaDataFileCheckModuleFilePpiFormat = 1\r
+ # Check Pcd Format in INF files\r
+ self.MetaDataFileCheckModuleFilePcdFormat = 1\r
\r
+ # Check UNI file\r
+ self.UniCheckAll = 0\r
+ # Check INF or DEC file whether defined the localized information in the associated UNI file.\r
+ self.UniCheckHelpInfo = 1\r
+ # Check PCD whether defined the prompt, help in the DEC file and localized information in the associated UNI file.\r
+ self.UniCheckPCDInfo = 1\r
+\r
+ # Check SMM communication function parameter\r
+ self.SmmCommParaCheckAll = 0\r
+ # Check if the EFI_SMM_COMMUNICATION_PROTOCOL parameter buffer type is Reserved / ACPI NVS or UEFI RT code/data\r
+ self.SmmCommParaCheckBufferType = -1\r
+\r
#\r
# The check points in this section are reserved\r
#\r
\r
# The directory listed here will not be parsed, split with ','\r
self.SkipDirList = []\r
+ \r
+ # The file listed here will not be parsed, split with ','\r
+ self.SkipFileList = []\r
\r
- self.ParseConfig()\r
+ # A list for binary file ext name\r
+ self.BinaryExtList = []\r
\r
+ # A list for only scanned folders\r
+ self.ScanOnlyDirList = []\r
+ \r
+ # A list for Copyright format\r
+ self.Copyright = []\r
+\r
+ self.ParseConfig()\r
+\r
def ParseConfig(self):\r
Filepath = os.path.normpath(self.Filename)\r
if not os.path.isfile(Filepath):\r
ErrorMsg = "Can't find configuration file '%s'" % Filepath\r
EdkLogger.error("Ecc", EdkLogger.ECC_ERROR, ErrorMsg, File = Filepath)\r
- \r
+\r
LineNo = 0\r
for Line in open(Filepath, 'r'):\r
LineNo = LineNo + 1\r
continue\r
if List[0] == 'SkipDirList':\r
List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)\r
+ if List[0] == 'SkipFileList':\r
+ List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)\r
+ if List[0] == 'BinaryExtList':\r
+ List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)\r
+ if List[0] == 'Copyright':\r
+ List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)\r
self.__dict__[List[0]] = List[1]\r
- \r
+\r
def ShowMe(self):\r
print self.Filename\r
for Key in self.__dict__.keys():\r