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/
This commit is contained in:
Georgiy Komarov 2021-01-08 12:25:51 +03:00 committed by GitHub
parent b6f4961e4a
commit 13b8ee8871
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -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