## @file\r
# This file is used to define checkpoints used by ECC tool\r
#\r
-# Copyright (c) 2008 - 2010, Intel Corporation\r
-# All rights reserved. This program and the accompanying materials\r
+# Copyright (c) 2008 - 2010, 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
for Dirpath, Dirnames, Filenames in self.WalkTree():\r
for F in Filenames:\r
- if os.path.splitext(F)[1] in ('.h', '.c'):\r
+ Ext = os.path.splitext(F)[1]\r
+ if Ext in ('.h', '.c'):\r
FullName = os.path.join(Dirpath, F)\r
MsgList = c.CheckFileHeaderDoxygenComments(FullName)\r
+ elif Ext in ('.inf', '.dec', '.dsc', '.fdf'):\r
+ FullName = os.path.join(Dirpath, F)\r
+ if not open(FullName).read().startswith('## @file'):\r
+ SqlStatement = """ select ID from File where FullPath like '%s'""" % FullName\r
+ ResultSet = EccGlobalData.gDb.TblFile.Exec(SqlStatement)\r
+ for Result in ResultSet:\r
+ Msg = 'INF/DEC/DSC/FDF file header comment should begin with ""## @file""'\r
+ EccGlobalData.gDb.TblReport.Insert(ERROR_DOXYGEN_CHECK_FILE_HEADER, Msg, "File", Result[0])\r
+ \r
\r
# Check whether the function headers are followed Doxygen special documentation blocks in section 2.3.5\r
def DoxygenCheckFunctionHeader(self):\r
self.MetaDataFileCheckGuidDuplicate()\r
self.MetaDataFileCheckModuleFileNoUse()\r
self.MetaDataFileCheckPcdType()\r
+ self.MetaDataFileCheckModuleFileGuidDuplication()\r
\r
# Check whether each file defined in meta-data exists\r
def MetaDataFileCheckPathName(self):\r
#ERROR_META_DATA_FILE_CHECK_PCD_TYPE\r
pass\r
\r
+ # Internal worker function to get the INF workspace relative path from FileID\r
+ def GetInfFilePathFromID(self, FileID):\r
+ Table = EccGlobalData.gDb.TblFile\r
+ SqlCommand = """select A.FullPath from %s as A where A.ID = %s""" % (Table.Table, FileID)\r
+ RecordSet = Table.Exec(SqlCommand)\r
+ Path = ""\r
+ for Record in RecordSet:\r
+ Path = Record[0].replace(EccGlobalData.gWorkspace, '')\r
+ if Path.startswith('\\') or Path.startswith('/'):\r
+ Path = Path[1:]\r
+ return Path\r
+ \r
+ # Check whether two module INFs under one workspace has the same FILE_GUID value\r
+ def MetaDataFileCheckModuleFileGuidDuplication(self):\r
+ if EccGlobalData.gConfig.MetaDataFileCheckModuleFileGuidDuplication == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':\r
+ EdkLogger.quiet("Checking for pcd type in c code function usage ...")\r
+ Table = EccGlobalData.gDb.TblInf\r
+ SqlCommand = """\r
+ select A.ID, A.Value2, A.BelongsToFile, B.BelongsToFile from %s as A, %s as B\r
+ where A.Value1 = 'FILE_GUID' and B.Value1 = 'FILE_GUID' and\r
+ A.Value2 = B.Value2 and A.ID <> B.ID group by A.ID\r
+ """ % (Table.Table, Table.Table)\r
+ RecordSet = Table.Exec(SqlCommand)\r
+ for Record in RecordSet:\r
+ InfPath1 = self.GetInfFilePathFromID(Record[2])\r
+ InfPath2 = self.GetInfFilePathFromID(Record[3])\r
+ if InfPath1 and InfPath2:\r
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION, InfPath1):\r
+ Msg = "The FILE_GUID of INF file [%s] is duplicated with that of %s" % (InfPath1, InfPath2)\r
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION, OtherMsg = Msg, BelongsToTable = Table.Table, BelongsToItem = Record[0])\r
+ \r
+\r
# Check whether these is duplicate Guid/Ppi/Protocol name\r
def CheckGuidProtocolPpi(self, ErrorID, Model, Table):\r
Name = ''\r