From 13b8ee8871f9a2311f077677bd6fdfc18904caa7 Mon Sep 17 00:00:00 2001 From: Georgiy Komarov Date: Fri, 8 Jan 2021 12:25:51 +0300 Subject: [PATCH] cppcheckdata: Use instance attributes in Cppcheckdata (#3029) This commit makes CppcheckData class to use instance attributes instead of class attributes. Since class attributes are mutable (list), when you append to them, they don't promote to instance variable which means when you call parsedump() multiple times data just gets appended to them. Found by samed on the forum: https://sourceforge.net/p/cppcheck/discussion/general/thread/c6e1210ec2/ --- addons/cppcheckdata.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/cppcheckdata.py b/addons/cppcheckdata.py index a27e5c394..e54677fbe 100755 --- a/addons/cppcheckdata.py +++ b/addons/cppcheckdata.py @@ -852,15 +852,14 @@ class CppcheckData: @endcode """ - rawTokens = [] - platform = None - suppressions = [] - def __init__(self, filename): """ :param filename: Path to Cppcheck dump file """ self.filename = filename + self.rawTokens = [] + self.platform = None + self.suppressions = [] files = [] # source files for elements occurred in this configuration platform_done = False