diff options
author | Pierre Gondois <pierre.gondois@arm.com> | 2025-04-30 15:35:54 +0300 |
---|---|---|
committer | Liming Gao <gaoliming@byosoft.com.cn> | 2025-07-01 04:51:38 +0300 |
commit | 7402bd06cfa88a93a416a1edff7e7f9283ee18ed (patch) | |
tree | 29b1fb4d788b74b347433346a7d23d7428a4c52f /BaseTools/Source/Python/Ecc/CodeFragmentCollector.py | |
parent | c6e088cafcf3f7fe056e94480d3e5673498c7f91 (diff) | |
download | edk2-7402bd06cfa88a93a416a1edff7e7f9283ee18ed.tar.xz |
BaseTools: Ecc: Remove unnecessary code
Running the vulture tool on the Ecc folder gave the following
report. Remove the unnecessary code.
- Ecc/c.py:52:
unused function 'GetConfig' (60% confidence)
- Ecc/c.py:484:
unused function 'GetFileModificationTimeFromDB' (60% confidence)
- Ecc/CodeFragmentCollector.py:77:
unused attribute '__Token' (60% confidence)
- Ecc/CodeFragmentCollector.py:78:
unused attribute '__SkippedChars' (60% confidence)
- Ecc/CodeFragmentCollector.py:109:
unused method '__EndOfLine' (60% confidence)
- Ecc/CodeFragmentCollector.py:134:
unused method '__UndoOneChar' (60% confidence)
- Ecc/CodeFragmentCollector.py:221:
unused method '__InsertComma' (60% confidence)
- Ecc/CodeFragmentCollector.py:539:
unused method 'PrintFragments' (60% confidence)
- Ecc/Database.py:81:
unused attribute 'text_factory' (60% confidence)
- Ecc/Database.py:214:
unused method 'UpdateIdentifierBelongsToFunction_disabled'
(60% confidence)
- Ecc/MetaFileWorkspace/MetaDataTable.py:142:
unused method 'IsIntegral' (60% confidence)
- Ecc/MetaFileWorkspace/MetaDataTable.py:205:
unused method 'GetCrossIndex' (60% confidence)
- Ecc/Xml/XmlRoutines.py:145:
unused function 'XmlElementData' (60% confidence)
- Ecc/Xml/XmlRoutines.py:162:
unused function 'XmlElementList' (60% confidence)
- Ecc/Xml/XmlRoutines.py:192:
unused function 'XmlNodeName' (60% confidence)
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Diffstat (limited to 'BaseTools/Source/Python/Ecc/CodeFragmentCollector.py')
-rw-r--r-- | BaseTools/Source/Python/Ecc/CodeFragmentCollector.py | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py index d8d6aff08a..5bd3eec040 100644 --- a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py +++ b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py @@ -74,8 +74,6 @@ class CodeFragmentCollector: self.CurrentLineNumber = 1
self.CurrentOffsetWithinLine = 0
self.TokenReleaceList = []
- self.__Token = ""
- self.__SkippedChars = ""
## __EndOfFile() method
#
@@ -98,21 +96,6 @@ class CodeFragmentCollector: else:
return False
- ## __EndOfLine() method
- #
- # Judge current buffer pos is at line end
- #
- # @param self The object pointer
- # @retval True Current File buffer position is at line end
- # @retval False Current File buffer position is NOT at line end
- #
- def __EndOfLine(self):
- SizeOfCurrentLine = len(self.Profile.FileLinesList[self.CurrentLineNumber - 1])
- if self.CurrentOffsetWithinLine >= SizeOfCurrentLine - 1:
- return True
- else:
- return False
-
## Rewind() method
#
# Reset file data buffer to the initial state
@@ -123,25 +106,6 @@ class CodeFragmentCollector: self.CurrentLineNumber = 1
self.CurrentOffsetWithinLine = 0
- ## __UndoOneChar() method
- #
- # Go back one char in the file buffer
- #
- # @param self The object pointer
- # @retval True Successfully go back one char
- # @retval False Not able to go back one char as file beginning reached
- #
- def __UndoOneChar(self):
-
- if self.CurrentLineNumber == 1 and self.CurrentOffsetWithinLine == 0:
- return False
- elif self.CurrentOffsetWithinLine == 0:
- self.CurrentLineNumber -= 1
- self.CurrentOffsetWithinLine = len(self.__CurrentLine()) - 1
- else:
- self.CurrentOffsetWithinLine -= 1
- return True
-
## __GetOneChar() method
#
# Move forward one char in the file buffer
@@ -211,32 +175,6 @@ class CodeFragmentCollector: def __CurrentLine(self):
return self.Profile.FileLinesList[self.CurrentLineNumber - 1]
- ## __InsertComma() method
- #
- # Insert ',' to replace PP
- #
- # @param self The object pointer
- # @retval List current line contents
- #
- def __InsertComma(self, Line):
-
-
- if self.Profile.FileLinesList[Line - 1][0] != T_CHAR_HASH:
- BeforeHashPart = str(self.Profile.FileLinesList[Line - 1]).split(T_CHAR_HASH)[0]
- if BeforeHashPart.rstrip().endswith(T_CHAR_COMMA) or BeforeHashPart.rstrip().endswith(';'):
- return
-
- if Line - 2 >= 0 and str(self.Profile.FileLinesList[Line - 2]).rstrip().endswith(','):
- return
-
- if Line - 2 >= 0 and str(self.Profile.FileLinesList[Line - 2]).rstrip().endswith(';'):
- return
-
- if str(self.Profile.FileLinesList[Line]).lstrip().startswith(',') or str(self.Profile.FileLinesList[Line]).lstrip().startswith(';'):
- return
-
- self.Profile.FileLinesList[Line - 1].insert(self.CurrentOffsetWithinLine, ',')
-
## PreprocessFile() method
#
# Preprocess file contents, replace comments with spaces.
|