From 855698fb69fdb85fa24c4374d07947106f4de828 Mon Sep 17 00:00:00 2001 From: hchen30 Date: Wed, 8 Aug 2018 11:18:06 +0800 Subject: BaseTools/Ecc: Fix import issues 1. Complete the full path for import statement. Use "EccMain" to replace "Ecc" for the absolute path support. 2. Fix some issues on configuration file. 3. Fix an issue of RaiseError not working in EdkLogger. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen Reviewed-by: Liming Gao --- BaseTools/Source/Python/Ecc/CParser.py | 4 +- BaseTools/Source/Python/Ecc/Check.py | 8 +- .../Source/Python/Ecc/CodeFragmentCollector.py | 12 +- BaseTools/Source/Python/Ecc/Configuration.py | 2 + BaseTools/Source/Python/Ecc/Database.py | 6 +- BaseTools/Source/Python/Ecc/Ecc.py | 447 --------------------- BaseTools/Source/Python/Ecc/EccMain.py | 447 +++++++++++++++++++++ BaseTools/Source/Python/Ecc/Exception.py | 2 +- BaseTools/Source/Python/Ecc/FileProfile.py | 2 +- BaseTools/Source/Python/Ecc/MetaDataParser.py | 4 +- .../Python/Ecc/MetaFileWorkspace/MetaFileParser.py | 6 +- .../Python/Ecc/MetaFileWorkspace/MetaFileTable.py | 6 +- BaseTools/Source/Python/Ecc/c.py | 12 +- BaseTools/Source/Python/Ecc/config.ini | 4 +- 14 files changed, 482 insertions(+), 480 deletions(-) delete mode 100644 BaseTools/Source/Python/Ecc/Ecc.py create mode 100644 BaseTools/Source/Python/Ecc/EccMain.py (limited to 'BaseTools/Source/Python/Ecc') diff --git a/BaseTools/Source/Python/Ecc/CParser.py b/BaseTools/Source/Python/Ecc/CParser.py index 0b74b53ae7..a3ab8e7bf4 100644 --- a/BaseTools/Source/Python/Ecc/CParser.py +++ b/BaseTools/Source/Python/Ecc/CParser.py @@ -24,8 +24,8 @@ from antlr3.compat import set, frozenset # ## -from . import CodeFragment -from . import FileProfile +from Ecc import CodeFragment +from Ecc import FileProfile diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py index 6803afdfdd..fc86ad96f2 100644 --- a/BaseTools/Source/Python/Ecc/Check.py +++ b/BaseTools/Source/Python/Ecc/Check.py @@ -15,10 +15,10 @@ import Common.LongFilePathOs as os import re from CommonDataClass.DataClass import * import Common.DataType as DT -from .EccToolError import * -from .MetaDataParser import ParseHeaderCommentSection -from . import EccGlobalData -from . import c +from Ecc.EccToolError import * +from Ecc.MetaDataParser import ParseHeaderCommentSection +from Ecc import EccGlobalData +from Ecc import c from Common.LongFilePathSupport import OpenLongFilePath as open from Common.MultipleWorkspace import MultipleWorkspace as mws diff --git a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py index 28b4e0196f..d12232cc6f 100644 --- a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py +++ b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py @@ -23,13 +23,13 @@ import Common.LongFilePathOs as os import sys import antlr3 -from .CLexer import CLexer -from .CParser import CParser +from Ecc.CLexer import CLexer +from Ecc.CParser import CParser -from . import FileProfile -from .CodeFragment import Comment -from .CodeFragment import PP_Directive -from .ParserWarning import Warning +from Ecc import FileProfile +from Ecc.CodeFragment import Comment +from Ecc.CodeFragment import PP_Directive +from Ecc.ParserWarning import Warning ##define T_CHAR_SPACE ' ' diff --git a/BaseTools/Source/Python/Ecc/Configuration.py b/BaseTools/Source/Python/Ecc/Configuration.py index f58adbf736..c19a3990c7 100644 --- a/BaseTools/Source/Python/Ecc/Configuration.py +++ b/BaseTools/Source/Python/Ecc/Configuration.py @@ -60,12 +60,14 @@ _ConfigFileToInternalTranslation = { "GeneralCheckIndentation":"GeneralCheckIndentation", "GeneralCheckIndentationWidth":"GeneralCheckIndentationWidth", "GeneralCheckLine":"GeneralCheckLine", + "GeneralCheckLineEnding":"GeneralCheckLineEnding", "GeneralCheckLineWidth":"GeneralCheckLineWidth", "GeneralCheckNoProgma":"GeneralCheckNoProgma", "GeneralCheckNoTab":"GeneralCheckNoTab", "GeneralCheckNo_Asm":"GeneralCheckNo_Asm", "GeneralCheckNonAcsii":"GeneralCheckNonAcsii", "GeneralCheckTabWidth":"GeneralCheckTabWidth", + "GeneralCheckTrailingWhiteSpaceLine":"GeneralCheckTrailingWhiteSpaceLine", "GeneralCheckUni":"GeneralCheckUni", "HeaderCheckAll":"HeaderCheckAll", "HeaderCheckCFileCommentLicenseFormat":"HeaderCheckCFileCommentLicenseFormat", diff --git a/BaseTools/Source/Python/Ecc/Database.py b/BaseTools/Source/Python/Ecc/Database.py index 34f49f3cba..9d4acac7b7 100644 --- a/BaseTools/Source/Python/Ecc/Database.py +++ b/BaseTools/Source/Python/Ecc/Database.py @@ -27,9 +27,9 @@ from Table.TableFunction import TableFunction from Table.TablePcd import TablePcd from Table.TableIdentifier import TableIdentifier from Table.TableReport import TableReport -from .MetaFileWorkspace.MetaFileTable import ModuleTable -from .MetaFileWorkspace.MetaFileTable import PackageTable -from .MetaFileWorkspace.MetaFileTable import PlatformTable +from Ecc.MetaFileWorkspace.MetaFileTable import ModuleTable +from Ecc.MetaFileWorkspace.MetaFileTable import PackageTable +from Ecc.MetaFileWorkspace.MetaFileTable import PlatformTable from Table.TableFdf import TableFdf ## diff --git a/BaseTools/Source/Python/Ecc/Ecc.py b/BaseTools/Source/Python/Ecc/Ecc.py deleted file mode 100644 index 8f96bdf977..0000000000 --- a/BaseTools/Source/Python/Ecc/Ecc.py +++ /dev/null @@ -1,447 +0,0 @@ -## @file -# This file is used to be the main entrance of ECC tool -# -# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -## -# Import Modules -# -from __future__ import absolute_import -import Common.LongFilePathOs as os, time, glob, sys -import Common.EdkLogger as EdkLogger -from . import Database -from . import EccGlobalData -from .MetaDataParser import * -from optparse import OptionParser -from .Configuration import Configuration -from .Check import Check -import Common.GlobalData as GlobalData - -from Common.StringUtils import NormPath -from Common.BuildVersion import gBUILD_VERSION -from Common import BuildToolError -from Common.Misc import PathClass -from Common.Misc import DirCache -from .MetaFileWorkspace.MetaFileParser import DscParser -from .MetaFileWorkspace.MetaFileParser import DecParser -from .MetaFileWorkspace.MetaFileParser import InfParser -from .MetaFileWorkspace.MetaFileParser import Fdf -from .MetaFileWorkspace.MetaFileTable import MetaFileStorage -from . import c -import re, string -from .Exception import * -from Common.LongFilePathSupport import OpenLongFilePath as open -from Common.MultipleWorkspace import MultipleWorkspace as mws - -## Ecc -# -# This class is used to define Ecc main entrance -# -# @param object: Inherited from object class -# -class Ecc(object): - def __init__(self): - # Version and Copyright - self.VersionNumber = ("1.0" + " Build " + gBUILD_VERSION) - self.Version = "%prog Version " + self.VersionNumber - self.Copyright = "Copyright (c) 2009 - 2018, Intel Corporation All rights reserved." - - self.InitDefaultConfigIni() - self.OutputFile = 'output.txt' - self.ReportFile = 'Report.csv' - self.ExceptionFile = 'exception.xml' - self.IsInit = True - self.ScanSourceCode = True - self.ScanMetaData = True - self.MetaFile = '' - self.OnlyScan = None - - # Parse the options and args - self.ParseOption() - EdkLogger.info(time.strftime("%H:%M:%S, %b.%d %Y ", time.localtime()) + "[00:00]" + "\n") - - # - # Check EFI_SOURCE (Edk build convention). EDK_SOURCE will always point to ECP - # - WorkspaceDir = os.path.normcase(os.path.normpath(os.environ["WORKSPACE"])) - os.environ["WORKSPACE"] = WorkspaceDir - - # set multiple workspace - PackagesPath = os.getenv("PACKAGES_PATH") - mws.setWs(WorkspaceDir, PackagesPath) - - if "ECP_SOURCE" not in os.environ: - os.environ["ECP_SOURCE"] = mws.join(WorkspaceDir, GlobalData.gEdkCompatibilityPkg) - if "EFI_SOURCE" not in os.environ: - os.environ["EFI_SOURCE"] = os.environ["ECP_SOURCE"] - if "EDK_SOURCE" not in os.environ: - os.environ["EDK_SOURCE"] = os.environ["ECP_SOURCE"] - - # - # Unify case of characters on case-insensitive systems - # - EfiSourceDir = os.path.normcase(os.path.normpath(os.environ["EFI_SOURCE"])) - EdkSourceDir = os.path.normcase(os.path.normpath(os.environ["EDK_SOURCE"])) - EcpSourceDir = os.path.normcase(os.path.normpath(os.environ["ECP_SOURCE"])) - - os.environ["EFI_SOURCE"] = EfiSourceDir - os.environ["EDK_SOURCE"] = EdkSourceDir - os.environ["ECP_SOURCE"] = EcpSourceDir - - GlobalData.gWorkspace = WorkspaceDir - GlobalData.gEfiSource = EfiSourceDir - GlobalData.gEdkSource = EdkSourceDir - GlobalData.gEcpSource = EcpSourceDir - - GlobalData.gGlobalDefines["WORKSPACE"] = WorkspaceDir - GlobalData.gGlobalDefines["EFI_SOURCE"] = EfiSourceDir - GlobalData.gGlobalDefines["EDK_SOURCE"] = EdkSourceDir - GlobalData.gGlobalDefines["ECP_SOURCE"] = EcpSourceDir - - EdkLogger.info("Loading ECC configuration ... done") - # Generate checkpoints list - EccGlobalData.gConfig = Configuration(self.ConfigFile) - - # Generate exception list - EccGlobalData.gException = ExceptionCheck(self.ExceptionFile) - - # Init Ecc database - EccGlobalData.gDb = Database.Database(Database.DATABASE_PATH) - EccGlobalData.gDb.InitDatabase(self.IsInit) - - # - # Get files real name in workspace dir - # - GlobalData.gAllFiles = DirCache(GlobalData.gWorkspace) - - # Build ECC database -# self.BuildDatabase() - self.DetectOnlyScanDirs() - - # Start to check - self.Check() - - # Show report - self.GenReport() - - # Close Database - EccGlobalData.gDb.Close() - - def InitDefaultConfigIni(self): - paths = map(lambda p: os.path.join(p, 'Ecc', 'config.ini'), sys.path) - paths = (os.path.realpath('config.ini'),) + tuple(paths) - for path in paths: - if os.path.exists(path): - self.ConfigFile = path - return - self.ConfigFile = 'config.ini' - - - ## DetectOnlyScan - # - # Detect whether only scanned folders have been enabled - # - def DetectOnlyScanDirs(self): - if self.OnlyScan == True: - OnlyScanDirs = [] - # Use regex here if multiple spaces or TAB exists in ScanOnlyDirList in config.ini file - for folder in re.finditer(r'\S+', EccGlobalData.gConfig.ScanOnlyDirList): - OnlyScanDirs.append(folder.group()) - if len(OnlyScanDirs) != 0: - self.BuildDatabase(OnlyScanDirs) - else: - EdkLogger.error("ECC", BuildToolError.OPTION_VALUE_INVALID, ExtraData="Use -f option need to fill specific folders in config.ini file") - else: - self.BuildDatabase() - - - ## BuildDatabase - # - # Build the database for target - # - def BuildDatabase(self, SpeciDirs = None): - # Clean report table - EccGlobalData.gDb.TblReport.Drop() - EccGlobalData.gDb.TblReport.Create() - - # Build database - if self.IsInit: - if self.ScanMetaData: - EdkLogger.quiet("Building database for Meta Data File ...") - self.BuildMetaDataFileDatabase(SpeciDirs) - if self.ScanSourceCode: - EdkLogger.quiet("Building database for Meta Data File Done!") - if SpeciDirs is None: - c.CollectSourceCodeDataIntoDB(EccGlobalData.gTarget) - else: - for specificDir in SpeciDirs: - c.CollectSourceCodeDataIntoDB(os.path.join(EccGlobalData.gTarget, specificDir)) - - EccGlobalData.gIdentifierTableList = GetTableList((MODEL_FILE_C, MODEL_FILE_H), 'Identifier', EccGlobalData.gDb) - EccGlobalData.gCFileList = GetFileList(MODEL_FILE_C, EccGlobalData.gDb) - EccGlobalData.gHFileList = GetFileList(MODEL_FILE_H, EccGlobalData.gDb) - EccGlobalData.gUFileList = GetFileList(MODEL_FILE_UNI, EccGlobalData.gDb) - - ## BuildMetaDataFileDatabase - # - # Build the database for meta data files - # - def BuildMetaDataFileDatabase(self, SpecificDirs = None): - ScanFolders = [] - if SpecificDirs is None: - ScanFolders.append(EccGlobalData.gTarget) - else: - for specificDir in SpecificDirs: - ScanFolders.append(os.path.join(EccGlobalData.gTarget, specificDir)) - EdkLogger.quiet("Building database for meta data files ...") - Op = open(EccGlobalData.gConfig.MetaDataFileCheckPathOfGenerateFileList, 'w+') - #SkipDirs = Read from config file - SkipDirs = EccGlobalData.gConfig.SkipDirList - SkipDirString = string.join(SkipDirs, '|') -# p = re.compile(r'.*[\\/](?:%s)[\\/]?.*' % SkipDirString) - p = re.compile(r'.*[\\/](?:%s^\S)[\\/]?.*' % SkipDirString) - for scanFolder in ScanFolders: - for Root, Dirs, Files in os.walk(scanFolder): - if p.match(Root.upper()): - continue - for Dir in Dirs: - Dirname = os.path.join(Root, Dir) - if os.path.islink(Dirname): - Dirname = os.path.realpath(Dirname) - if os.path.isdir(Dirname): - # symlinks to directories are treated as directories - Dirs.remove(Dir) - Dirs.append(Dirname) - - for File in Files: - if len(File) > 4 and File[-4:].upper() == ".DEC": - Filename = os.path.normpath(os.path.join(Root, File)) - EdkLogger.quiet("Parsing %s" % Filename) - Op.write("%s\r" % Filename) - #Dec(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb) - self.MetaFile = DecParser(Filename, MODEL_FILE_DEC, EccGlobalData.gDb.TblDec) - self.MetaFile.Start() - continue - if len(File) > 4 and File[-4:].upper() == ".DSC": - Filename = os.path.normpath(os.path.join(Root, File)) - EdkLogger.quiet("Parsing %s" % Filename) - Op.write("%s\r" % Filename) - #Dsc(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb) - self.MetaFile = DscParser(PathClass(Filename, Root), MODEL_FILE_DSC, MetaFileStorage(EccGlobalData.gDb.TblDsc.Cur, Filename, MODEL_FILE_DSC, True)) - # alwasy do post-process, in case of macros change - self.MetaFile.DoPostProcess() - self.MetaFile.Start() - self.MetaFile._PostProcess() - continue - if len(File) > 4 and File[-4:].upper() == ".INF": - Filename = os.path.normpath(os.path.join(Root, File)) - EdkLogger.quiet("Parsing %s" % Filename) - Op.write("%s\r" % Filename) - #Inf(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb) - self.MetaFile = InfParser(Filename, MODEL_FILE_INF, EccGlobalData.gDb.TblInf) - self.MetaFile.Start() - continue - if len(File) > 4 and File[-4:].upper() == ".FDF": - Filename = os.path.normpath(os.path.join(Root, File)) - EdkLogger.quiet("Parsing %s" % Filename) - Op.write("%s\r" % Filename) - Fdf(Filename, True, EccGlobalData.gWorkspace, EccGlobalData.gDb) - continue - if len(File) > 4 and File[-4:].upper() == ".UNI": - Filename = os.path.normpath(os.path.join(Root, File)) - EdkLogger.quiet("Parsing %s" % Filename) - Op.write("%s\r" % Filename) - FileID = EccGlobalData.gDb.TblFile.InsertFile(Filename, MODEL_FILE_UNI) - EccGlobalData.gDb.TblReport.UpdateBelongsToItemByFile(FileID, File) - continue - - Op.close() - - # Commit to database - EccGlobalData.gDb.Conn.commit() - - EdkLogger.quiet("Building database for meta data files done!") - - ## - # - # Check each checkpoint - # - def Check(self): - EdkLogger.quiet("Checking ...") - EccCheck = Check() - EccCheck.Check() - EdkLogger.quiet("Checking done!") - - ## - # - # Generate the scan report - # - def GenReport(self): - EdkLogger.quiet("Generating report ...") - EccGlobalData.gDb.TblReport.ToCSV(self.ReportFile) - EdkLogger.quiet("Generating report done!") - - def GetRealPathCase(self, path): - TmpPath = path.rstrip(os.sep) - PathParts = TmpPath.split(os.sep) - if len(PathParts) == 0: - return path - if len(PathParts) == 1: - if PathParts[0].strip().endswith(':'): - return PathParts[0].upper() - # Relative dir, list . current dir - Dirs = os.listdir('.') - for Dir in Dirs: - if Dir.upper() == PathParts[0].upper(): - return Dir - - if PathParts[0].strip().endswith(':'): - PathParts[0] = PathParts[0].upper() - ParentDir = PathParts[0] - RealPath = ParentDir - if PathParts[0] == '': - RealPath = os.sep - ParentDir = os.sep - - PathParts.remove(PathParts[0]) # need to remove the parent - for Part in PathParts: - Dirs = os.listdir(ParentDir + os.sep) - for Dir in Dirs: - if Dir.upper() == Part.upper(): - RealPath += os.sep - RealPath += Dir - break - ParentDir += os.sep - ParentDir += Dir - - return RealPath - - ## ParseOption - # - # Parse options - # - def ParseOption(self): - (Options, Target) = self.EccOptionParser() - - if Options.Workspace: - os.environ["WORKSPACE"] = Options.Workspace - - # Check workspace envirnoment - if "WORKSPACE" not in os.environ: - EdkLogger.error("ECC", BuildToolError.ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found", - ExtraData="WORKSPACE") - else: - EccGlobalData.gWorkspace = os.path.normpath(os.getenv("WORKSPACE")) - if not os.path.exists(EccGlobalData.gWorkspace): - EdkLogger.error("ECC", BuildToolError.FILE_NOT_FOUND, ExtraData="WORKSPACE = %s" % EccGlobalData.gWorkspace) - os.environ["WORKSPACE"] = EccGlobalData.gWorkspace - # Set log level - self.SetLogLevel(Options) - - # Set other options - if Options.ConfigFile is not None: - self.ConfigFile = Options.ConfigFile - if Options.OutputFile is not None: - self.OutputFile = Options.OutputFile - if Options.ReportFile is not None: - self.ReportFile = Options.ReportFile - if Options.ExceptionFile is not None: - self.ExceptionFile = Options.ExceptionFile - if Options.Target is not None: - if not os.path.isdir(Options.Target): - EdkLogger.error("ECC", BuildToolError.OPTION_VALUE_INVALID, ExtraData="Target [%s] does NOT exist" % Options.Target) - else: - EccGlobalData.gTarget = self.GetRealPathCase(os.path.normpath(Options.Target)) - else: - EdkLogger.warn("Ecc", EdkLogger.ECC_ERROR, "The target source tree was not specified, using current WORKSPACE instead!") - EccGlobalData.gTarget = os.path.normpath(os.getenv("WORKSPACE")) - if Options.keepdatabase is not None: - self.IsInit = False - if Options.metadata is not None and Options.sourcecode is not None: - EdkLogger.error("ECC", BuildToolError.OPTION_CONFLICT, ExtraData="-m and -s can't be specified at one time") - if Options.metadata is not None: - self.ScanSourceCode = False - if Options.sourcecode is not None: - self.ScanMetaData = False - if Options.folders is not None: - self.OnlyScan = True - - ## SetLogLevel - # - # Set current log level of the tool based on args - # - # @param Option: The option list including log level setting - # - def SetLogLevel(self, Option): - if Option.verbose is not None: - EdkLogger.SetLevel(EdkLogger.VERBOSE) - elif Option.quiet is not None: - EdkLogger.SetLevel(EdkLogger.QUIET) - elif Option.debug is not None: - EdkLogger.SetLevel(Option.debug + 1) - else: - EdkLogger.SetLevel(EdkLogger.INFO) - - ## Parse command line options - # - # Using standard Python module optparse to parse command line option of this tool. - # - # @retval Opt A optparse.Values object containing the parsed options - # @retval Args Target of build command - # - def EccOptionParser(self): - Parser = OptionParser(description = self.Copyright, version = self.Version, prog = "Ecc.exe", usage = "%prog [options]") - Parser.add_option("-t", "--target sourcepath", action="store", type="string", dest='Target', - help="Check all files under the target workspace.") - Parser.add_option("-c", "--config filename", action="store", type="string", dest="ConfigFile", - help="Specify a configuration file. Defaultly use config.ini under ECC tool directory.") - Parser.add_option("-o", "--outfile filename", action="store", type="string", dest="OutputFile", - help="Specify the name of an output file, if and only if one filename was specified.") - Parser.add_option("-r", "--reportfile filename", action="store", type="string", dest="ReportFile", - help="Specify the name of an report file, if and only if one filename was specified.") - Parser.add_option("-e", "--exceptionfile filename", action="store", type="string", dest="ExceptionFile", - help="Specify the name of an exception file, if and only if one filename was specified.") - Parser.add_option("-m", "--metadata", action="store_true", type=None, help="Only scan meta-data files information if this option is specified.") - Parser.add_option("-s", "--sourcecode", action="store_true", type=None, help="Only scan source code files information if this option is specified.") - Parser.add_option("-k", "--keepdatabase", action="store_true", type=None, help="The existing Ecc database will not be cleaned except report information if this option is specified.") - Parser.add_option("-l", "--log filename", action="store", dest="LogFile", help="""If specified, the tool should emit the changes that - were made by the tool after printing the result message. - If filename, the emit to the file, otherwise emit to - standard output. If no modifications were made, then do not - create a log file, or output a log message.""") - Parser.add_option("-q", "--quiet", action="store_true", type=None, help="Disable all messages except FATAL ERRORS.") - Parser.add_option("-v", "--verbose", action="store_true", type=None, help="Turn on verbose output with informational messages printed, "\ - "including library instances selected, final dependency expression, "\ - "and warning messages, etc.") - Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.") - Parser.add_option("-w", "--workspace", action="store", type="string", dest='Workspace', help="Specify workspace.") - Parser.add_option("-f", "--folders", action="store_true", type=None, help="Only scanning specified folders which are recorded in config.ini file.") - - (Opt, Args)=Parser.parse_args() - - return (Opt, Args) - -## -# -# This acts like the main() function for the script, unless it is 'import'ed into another -# script. -# -if __name__ == '__main__': - # Initialize log system - EdkLogger.Initialize() - EdkLogger.IsRaiseError = False - - StartTime = time.clock() - Ecc = Ecc() - FinishTime = time.clock() - - BuildDuration = time.strftime("%M:%S", time.gmtime(int(round(FinishTime - StartTime)))) - EdkLogger.quiet("\n%s [%s]" % (time.strftime("%H:%M:%S, %b.%d %Y", time.localtime()), BuildDuration)) diff --git a/BaseTools/Source/Python/Ecc/EccMain.py b/BaseTools/Source/Python/Ecc/EccMain.py new file mode 100644 index 0000000000..5f9e497e37 --- /dev/null +++ b/BaseTools/Source/Python/Ecc/EccMain.py @@ -0,0 +1,447 @@ +## @file +# This file is used to be the main entrance of ECC tool +# +# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## +# Import Modules +# +from __future__ import absolute_import +import Common.LongFilePathOs as os, time, glob, sys +import Common.EdkLogger as EdkLogger +from Ecc import Database +from Ecc import EccGlobalData +from Ecc.MetaDataParser import * +from optparse import OptionParser +from Ecc.Configuration import Configuration +from Ecc.Check import Check +import Common.GlobalData as GlobalData + +from Common.StringUtils import NormPath +from Common.BuildVersion import gBUILD_VERSION +from Common import BuildToolError +from Common.Misc import PathClass +from Common.Misc import DirCache +from Ecc.MetaFileWorkspace.MetaFileParser import DscParser +from Ecc.MetaFileWorkspace.MetaFileParser import DecParser +from Ecc.MetaFileWorkspace.MetaFileParser import InfParser +from Ecc.MetaFileWorkspace.MetaFileParser import Fdf +from Ecc.MetaFileWorkspace.MetaFileTable import MetaFileStorage +from Ecc import c +import re, string +from Ecc.Exception import * +from Common.LongFilePathSupport import OpenLongFilePath as open +from Common.MultipleWorkspace import MultipleWorkspace as mws + +## Ecc +# +# This class is used to define Ecc main entrance +# +# @param object: Inherited from object class +# +class Ecc(object): + def __init__(self): + # Version and Copyright + self.VersionNumber = ("1.0" + " Build " + gBUILD_VERSION) + self.Version = "%prog Version " + self.VersionNumber + self.Copyright = "Copyright (c) 2009 - 2018, Intel Corporation All rights reserved." + + self.InitDefaultConfigIni() + self.OutputFile = 'output.txt' + self.ReportFile = 'Report.csv' + self.ExceptionFile = 'exception.xml' + self.IsInit = True + self.ScanSourceCode = True + self.ScanMetaData = True + self.MetaFile = '' + self.OnlyScan = None + + # Parse the options and args + self.ParseOption() + EdkLogger.info(time.strftime("%H:%M:%S, %b.%d %Y ", time.localtime()) + "[00:00]" + "\n") + + # + # Check EFI_SOURCE (Edk build convention). EDK_SOURCE will always point to ECP + # + WorkspaceDir = os.path.normcase(os.path.normpath(os.environ["WORKSPACE"])) + os.environ["WORKSPACE"] = WorkspaceDir + + # set multiple workspace + PackagesPath = os.getenv("PACKAGES_PATH") + mws.setWs(WorkspaceDir, PackagesPath) + + if "ECP_SOURCE" not in os.environ: + os.environ["ECP_SOURCE"] = mws.join(WorkspaceDir, GlobalData.gEdkCompatibilityPkg) + if "EFI_SOURCE" not in os.environ: + os.environ["EFI_SOURCE"] = os.environ["ECP_SOURCE"] + if "EDK_SOURCE" not in os.environ: + os.environ["EDK_SOURCE"] = os.environ["ECP_SOURCE"] + + # + # Unify case of characters on case-insensitive systems + # + EfiSourceDir = os.path.normcase(os.path.normpath(os.environ["EFI_SOURCE"])) + EdkSourceDir = os.path.normcase(os.path.normpath(os.environ["EDK_SOURCE"])) + EcpSourceDir = os.path.normcase(os.path.normpath(os.environ["ECP_SOURCE"])) + + os.environ["EFI_SOURCE"] = EfiSourceDir + os.environ["EDK_SOURCE"] = EdkSourceDir + os.environ["ECP_SOURCE"] = EcpSourceDir + + GlobalData.gWorkspace = WorkspaceDir + GlobalData.gEfiSource = EfiSourceDir + GlobalData.gEdkSource = EdkSourceDir + GlobalData.gEcpSource = EcpSourceDir + + GlobalData.gGlobalDefines["WORKSPACE"] = WorkspaceDir + GlobalData.gGlobalDefines["EFI_SOURCE"] = EfiSourceDir + GlobalData.gGlobalDefines["EDK_SOURCE"] = EdkSourceDir + GlobalData.gGlobalDefines["ECP_SOURCE"] = EcpSourceDir + + EdkLogger.info("Loading ECC configuration ... done") + # Generate checkpoints list + EccGlobalData.gConfig = Configuration(self.ConfigFile) + + # Generate exception list + EccGlobalData.gException = ExceptionCheck(self.ExceptionFile) + + # Init Ecc database + EccGlobalData.gDb = Database.Database(Database.DATABASE_PATH) + EccGlobalData.gDb.InitDatabase(self.IsInit) + + # + # Get files real name in workspace dir + # + GlobalData.gAllFiles = DirCache(GlobalData.gWorkspace) + + # Build ECC database +# self.BuildDatabase() + self.DetectOnlyScanDirs() + + # Start to check + self.Check() + + # Show report + self.GenReport() + + # Close Database + EccGlobalData.gDb.Close() + + def InitDefaultConfigIni(self): + paths = map(lambda p: os.path.join(p, 'Ecc', 'config.ini'), sys.path) + paths = (os.path.realpath('config.ini'),) + tuple(paths) + for path in paths: + if os.path.exists(path): + self.ConfigFile = path + return + self.ConfigFile = 'config.ini' + + + ## DetectOnlyScan + # + # Detect whether only scanned folders have been enabled + # + def DetectOnlyScanDirs(self): + if self.OnlyScan == True: + OnlyScanDirs = [] + # Use regex here if multiple spaces or TAB exists in ScanOnlyDirList in config.ini file + for folder in re.finditer(r'\S+', EccGlobalData.gConfig.ScanOnlyDirList): + OnlyScanDirs.append(folder.group()) + if len(OnlyScanDirs) != 0: + self.BuildDatabase(OnlyScanDirs) + else: + EdkLogger.error("ECC", BuildToolError.OPTION_VALUE_INVALID, ExtraData="Use -f option need to fill specific folders in config.ini file") + else: + self.BuildDatabase() + + + ## BuildDatabase + # + # Build the database for target + # + def BuildDatabase(self, SpeciDirs = None): + # Clean report table + EccGlobalData.gDb.TblReport.Drop() + EccGlobalData.gDb.TblReport.Create() + + # Build database + if self.IsInit: + if self.ScanMetaData: + EdkLogger.quiet("Building database for Meta Data File ...") + self.BuildMetaDataFileDatabase(SpeciDirs) + if self.ScanSourceCode: + EdkLogger.quiet("Building database for Meta Data File Done!") + if SpeciDirs is None: + c.CollectSourceCodeDataIntoDB(EccGlobalData.gTarget) + else: + for specificDir in SpeciDirs: + c.CollectSourceCodeDataIntoDB(os.path.join(EccGlobalData.gTarget, specificDir)) + + EccGlobalData.gIdentifierTableList = GetTableList((MODEL_FILE_C, MODEL_FILE_H), 'Identifier', EccGlobalData.gDb) + EccGlobalData.gCFileList = GetFileList(MODEL_FILE_C, EccGlobalData.gDb) + EccGlobalData.gHFileList = GetFileList(MODEL_FILE_H, EccGlobalData.gDb) + EccGlobalData.gUFileList = GetFileList(MODEL_FILE_UNI, EccGlobalData.gDb) + + ## BuildMetaDataFileDatabase + # + # Build the database for meta data files + # + def BuildMetaDataFileDatabase(self, SpecificDirs = None): + ScanFolders = [] + if SpecificDirs is None: + ScanFolders.append(EccGlobalData.gTarget) + else: + for specificDir in SpecificDirs: + ScanFolders.append(os.path.join(EccGlobalData.gTarget, specificDir)) + EdkLogger.quiet("Building database for meta data files ...") + Op = open(EccGlobalData.gConfig.MetaDataFileCheckPathOfGenerateFileList, 'w+') + #SkipDirs = Read from config file + SkipDirs = EccGlobalData.gConfig.SkipDirList + SkipDirString = string.join(SkipDirs, '|') +# p = re.compile(r'.*[\\/](?:%s)[\\/]?.*' % SkipDirString) + p = re.compile(r'.*[\\/](?:%s^\S)[\\/]?.*' % SkipDirString) + for scanFolder in ScanFolders: + for Root, Dirs, Files in os.walk(scanFolder): + if p.match(Root.upper()): + continue + for Dir in Dirs: + Dirname = os.path.join(Root, Dir) + if os.path.islink(Dirname): + Dirname = os.path.realpath(Dirname) + if os.path.isdir(Dirname): + # symlinks to directories are treated as directories + Dirs.remove(Dir) + Dirs.append(Dirname) + + for File in Files: + if len(File) > 4 and File[-4:].upper() == ".DEC": + Filename = os.path.normpath(os.path.join(Root, File)) + EdkLogger.quiet("Parsing %s" % Filename) + Op.write("%s\r" % Filename) + #Dec(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb) + self.MetaFile = DecParser(Filename, MODEL_FILE_DEC, EccGlobalData.gDb.TblDec) + self.MetaFile.Start() + continue + if len(File) > 4 and File[-4:].upper() == ".DSC": + Filename = os.path.normpath(os.path.join(Root, File)) + EdkLogger.quiet("Parsing %s" % Filename) + Op.write("%s\r" % Filename) + #Dsc(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb) + self.MetaFile = DscParser(PathClass(Filename, Root), MODEL_FILE_DSC, MetaFileStorage(EccGlobalData.gDb.TblDsc.Cur, Filename, MODEL_FILE_DSC, True)) + # alwasy do post-process, in case of macros change + self.MetaFile.DoPostProcess() + self.MetaFile.Start() + self.MetaFile._PostProcess() + continue + if len(File) > 4 and File[-4:].upper() == ".INF": + Filename = os.path.normpath(os.path.join(Root, File)) + EdkLogger.quiet("Parsing %s" % Filename) + Op.write("%s\r" % Filename) + #Inf(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb) + self.MetaFile = InfParser(Filename, MODEL_FILE_INF, EccGlobalData.gDb.TblInf) + self.MetaFile.Start() + continue + if len(File) > 4 and File[-4:].upper() == ".FDF": + Filename = os.path.normpath(os.path.join(Root, File)) + EdkLogger.quiet("Parsing %s" % Filename) + Op.write("%s\r" % Filename) + Fdf(Filename, True, EccGlobalData.gWorkspace, EccGlobalData.gDb) + continue + if len(File) > 4 and File[-4:].upper() == ".UNI": + Filename = os.path.normpath(os.path.join(Root, File)) + EdkLogger.quiet("Parsing %s" % Filename) + Op.write("%s\r" % Filename) + FileID = EccGlobalData.gDb.TblFile.InsertFile(Filename, MODEL_FILE_UNI) + EccGlobalData.gDb.TblReport.UpdateBelongsToItemByFile(FileID, File) + continue + + Op.close() + + # Commit to database + EccGlobalData.gDb.Conn.commit() + + EdkLogger.quiet("Building database for meta data files done!") + + ## + # + # Check each checkpoint + # + def Check(self): + EdkLogger.quiet("Checking ...") + EccCheck = Check() + EccCheck.Check() + EdkLogger.quiet("Checking done!") + + ## + # + # Generate the scan report + # + def GenReport(self): + EdkLogger.quiet("Generating report ...") + EccGlobalData.gDb.TblReport.ToCSV(self.ReportFile) + EdkLogger.quiet("Generating report done!") + + def GetRealPathCase(self, path): + TmpPath = path.rstrip(os.sep) + PathParts = TmpPath.split(os.sep) + if len(PathParts) == 0: + return path + if len(PathParts) == 1: + if PathParts[0].strip().endswith(':'): + return PathParts[0].upper() + # Relative dir, list . current dir + Dirs = os.listdir('.') + for Dir in Dirs: + if Dir.upper() == PathParts[0].upper(): + return Dir + + if PathParts[0].strip().endswith(':'): + PathParts[0] = PathParts[0].upper() + ParentDir = PathParts[0] + RealPath = ParentDir + if PathParts[0] == '': + RealPath = os.sep + ParentDir = os.sep + + PathParts.remove(PathParts[0]) # need to remove the parent + for Part in PathParts: + Dirs = os.listdir(ParentDir + os.sep) + for Dir in Dirs: + if Dir.upper() == Part.upper(): + RealPath += os.sep + RealPath += Dir + break + ParentDir += os.sep + ParentDir += Dir + + return RealPath + + ## ParseOption + # + # Parse options + # + def ParseOption(self): + (Options, Target) = self.EccOptionParser() + + if Options.Workspace: + os.environ["WORKSPACE"] = Options.Workspace + + # Check workspace envirnoment + if "WORKSPACE" not in os.environ: + EdkLogger.error("ECC", BuildToolError.ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found", + ExtraData="WORKSPACE") + else: + EccGlobalData.gWorkspace = os.path.normpath(os.getenv("WORKSPACE")) + if not os.path.exists(EccGlobalData.gWorkspace): + EdkLogger.error("ECC", BuildToolError.FILE_NOT_FOUND, ExtraData="WORKSPACE = %s" % EccGlobalData.gWorkspace) + os.environ["WORKSPACE"] = EccGlobalData.gWorkspace + # Set log level + self.SetLogLevel(Options) + + # Set other options + if Options.ConfigFile is not None: + self.ConfigFile = Options.ConfigFile + if Options.OutputFile is not None: + self.OutputFile = Options.OutputFile + if Options.ReportFile is not None: + self.ReportFile = Options.ReportFile + if Options.ExceptionFile is not None: + self.ExceptionFile = Options.ExceptionFile + if Options.Target is not None: + if not os.path.isdir(Options.Target): + EdkLogger.error("ECC", BuildToolError.OPTION_VALUE_INVALID, ExtraData="Target [%s] does NOT exist" % Options.Target) + else: + EccGlobalData.gTarget = self.GetRealPathCase(os.path.normpath(Options.Target)) + else: + EdkLogger.warn("Ecc", EdkLogger.ECC_ERROR, "The target source tree was not specified, using current WORKSPACE instead!") + EccGlobalData.gTarget = os.path.normpath(os.getenv("WORKSPACE")) + if Options.keepdatabase is not None: + self.IsInit = False + if Options.metadata is not None and Options.sourcecode is not None: + EdkLogger.error("ECC", BuildToolError.OPTION_CONFLICT, ExtraData="-m and -s can't be specified at one time") + if Options.metadata is not None: + self.ScanSourceCode = False + if Options.sourcecode is not None: + self.ScanMetaData = False + if Options.folders is not None: + self.OnlyScan = True + + ## SetLogLevel + # + # Set current log level of the tool based on args + # + # @param Option: The option list including log level setting + # + def SetLogLevel(self, Option): + if Option.verbose is not None: + EdkLogger.SetLevel(EdkLogger.VERBOSE) + elif Option.quiet is not None: + EdkLogger.SetLevel(EdkLogger.QUIET) + elif Option.debug is not None: + EdkLogger.SetLevel(Option.debug + 1) + else: + EdkLogger.SetLevel(EdkLogger.INFO) + + ## Parse command line options + # + # Using standard Python module optparse to parse command line option of this tool. + # + # @retval Opt A optparse.Values object containing the parsed options + # @retval Args Target of build command + # + def EccOptionParser(self): + Parser = OptionParser(description = self.Copyright, version = self.Version, prog = "Ecc.exe", usage = "%prog [options]") + Parser.add_option("-t", "--target sourcepath", action="store", type="string", dest='Target', + help="Check all files under the target workspace.") + Parser.add_option("-c", "--config filename", action="store", type="string", dest="ConfigFile", + help="Specify a configuration file. Defaultly use config.ini under ECC tool directory.") + Parser.add_option("-o", "--outfile filename", action="store", type="string", dest="OutputFile", + help="Specify the name of an output file, if and only if one filename was specified.") + Parser.add_option("-r", "--reportfile filename", action="store", type="string", dest="ReportFile", + help="Specify the name of an report file, if and only if one filename was specified.") + Parser.add_option("-e", "--exceptionfile filename", action="store", type="string", dest="ExceptionFile", + help="Specify the name of an exception file, if and only if one filename was specified.") + Parser.add_option("-m", "--metadata", action="store_true", type=None, help="Only scan meta-data files information if this option is specified.") + Parser.add_option("-s", "--sourcecode", action="store_true", type=None, help="Only scan source code files information if this option is specified.") + Parser.add_option("-k", "--keepdatabase", action="store_true", type=None, help="The existing Ecc database will not be cleaned except report information if this option is specified.") + Parser.add_option("-l", "--log filename", action="store", dest="LogFile", help="""If specified, the tool should emit the changes that + were made by the tool after printing the result message. + If filename, the emit to the file, otherwise emit to + standard output. If no modifications were made, then do not + create a log file, or output a log message.""") + Parser.add_option("-q", "--quiet", action="store_true", type=None, help="Disable all messages except FATAL ERRORS.") + Parser.add_option("-v", "--verbose", action="store_true", type=None, help="Turn on verbose output with informational messages printed, "\ + "including library instances selected, final dependency expression, "\ + "and warning messages, etc.") + Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.") + Parser.add_option("-w", "--workspace", action="store", type="string", dest='Workspace', help="Specify workspace.") + Parser.add_option("-f", "--folders", action="store_true", type=None, help="Only scanning specified folders which are recorded in config.ini file.") + + (Opt, Args)=Parser.parse_args() + + return (Opt, Args) + +## +# +# This acts like the main() function for the script, unless it is 'import'ed into another +# script. +# +if __name__ == '__main__': + # Initialize log system + EdkLogger.Initialize() + EdkLogger.IsRaiseError = False + + StartTime = time.clock() + Ecc = Ecc() + FinishTime = time.clock() + + BuildDuration = time.strftime("%M:%S", time.gmtime(int(round(FinishTime - StartTime)))) + EdkLogger.quiet("\n%s [%s]" % (time.strftime("%H:%M:%S, %b.%d %Y", time.localtime()), BuildDuration)) diff --git a/BaseTools/Source/Python/Ecc/Exception.py b/BaseTools/Source/Python/Ecc/Exception.py index 340e0e9752..8b827d7cfe 100644 --- a/BaseTools/Source/Python/Ecc/Exception.py +++ b/BaseTools/Source/Python/Ecc/Exception.py @@ -16,7 +16,7 @@ # from __future__ import print_function from __future__ import absolute_import -from .Xml.XmlRoutines import * +from Ecc.Xml.XmlRoutines import * import Common.LongFilePathOs as os # ExceptionXml to parse Exception Node of XML file diff --git a/BaseTools/Source/Python/Ecc/FileProfile.py b/BaseTools/Source/Python/Ecc/FileProfile.py index 1d3fbf2d3b..4434981628 100644 --- a/BaseTools/Source/Python/Ecc/FileProfile.py +++ b/BaseTools/Source/Python/Ecc/FileProfile.py @@ -19,7 +19,7 @@ from __future__ import absolute_import import re import Common.LongFilePathOs as os -from .ParserWarning import Warning +from Ecc.ParserWarning import Warning from Common.LongFilePathSupport import OpenLongFilePath as open CommentList = [] diff --git a/BaseTools/Source/Python/Ecc/MetaDataParser.py b/BaseTools/Source/Python/Ecc/MetaDataParser.py index e5744dd5cc..d0a94153d4 100644 --- a/BaseTools/Source/Python/Ecc/MetaDataParser.py +++ b/BaseTools/Source/Python/Ecc/MetaDataParser.py @@ -14,9 +14,9 @@ from __future__ import absolute_import import Common.LongFilePathOs as os from CommonDataClass.DataClass import * -from .EccToolError import * +from Ecc.EccToolError import * from Common.MultipleWorkspace import MultipleWorkspace as mws -from . import EccGlobalData +from Ecc import EccGlobalData import re ## Get the inlcude path list for a source file # diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py index 51669815b5..a2cd30d3d9 100644 --- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py @@ -22,8 +22,8 @@ import copy import Common.EdkLogger as EdkLogger import Common.GlobalData as GlobalData -import EccGlobalData -import EccToolError +import Ecc.EccGlobalData as EccGlobalData +import Ecc.EccToolError as EccToolError from CommonDataClass.DataClass import * from Common.DataType import * @@ -32,7 +32,7 @@ from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, PathClas from Common.Expression import * from CommonDataClass.Exceptions import * -from .MetaFileTable import MetaFileStorage +from Ecc.MetaFileWorkspace.MetaFileTable import MetaFileStorage from GenFds.FdfParser import FdfParser from Common.LongFilePathSupport import OpenLongFilePath as open from Common.LongFilePathSupport import CodecOpenLongFilePath diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py index 7e0afd5d70..a2319a94f6 100644 --- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py +++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py @@ -18,10 +18,10 @@ from __future__ import absolute_import import uuid import Common.EdkLogger as EdkLogger -import EccGlobalData +import Ecc.EccGlobalData as EccGlobalData -from .MetaDataTable import Table -from .MetaDataTable import ConvertToSqlString +from Ecc.MetaFileWorkspace.MetaDataTable import Table +from Ecc.MetaFileWorkspace.MetaDataTable import ConvertToSqlString from CommonDataClass.DataClass import MODEL_FILE_DSC, MODEL_FILE_DEC, MODEL_FILE_INF, \ MODEL_FILE_OTHERS diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py index 5616c10853..953f1630b6 100644 --- a/BaseTools/Source/Python/Ecc/c.py +++ b/BaseTools/Source/Python/Ecc/c.py @@ -17,14 +17,14 @@ import sys import Common.LongFilePathOs as os import re import string -from . import CodeFragmentCollector -from . import FileProfile +from Ecc import CodeFragmentCollector +from Ecc import FileProfile from CommonDataClass import DataClass -from . import Database +from Ecc import Database from Common import EdkLogger -from .EccToolError import * -from . import EccGlobalData -from . import MetaDataParser +from Ecc.EccToolError import * +from Ecc import EccGlobalData +from Ecc import MetaDataParser IncludeFileListDict = {} AllIncludeFileListDict = {} diff --git a/BaseTools/Source/Python/Ecc/config.ini b/BaseTools/Source/Python/Ecc/config.ini index 6c86da74d6..00c98c6232 100644 --- a/BaseTools/Source/Python/Ecc/config.ini +++ b/BaseTools/Source/Python/Ecc/config.ini @@ -73,9 +73,9 @@ GeneralCheckNonAcsii = 1 # Check whether UNI file is valid GeneralCheckUni = 1 # Check Only use CRLF (Carriage Return Line Feed) line endings. -self.GeneralCheckLineEnding = 1 +GeneralCheckLineEnding = 1 # Check if there is no trailing white space in one line. -self.GeneralCheckTrailingWhiteSpaceLine = 1 +GeneralCheckTrailingWhiteSpaceLine = 1 # # Space Checking -- cgit v1.2.3