@@ -87,6 +87,8 @@ def generate_suppressions(xml_tree: ET.ElementTree, old_source_root: str) -> Lis
87
87
88
88
# Build list of suppression objects
89
89
suppressions = []
90
+ # Create a separate list of internal cppcheck errors
91
+ internal_errors = []
90
92
for error in errors :
91
93
error_type = error .get ("id" )
92
94
# checkersReport has no location
@@ -98,19 +100,29 @@ def generate_suppressions(xml_tree: ET.ElementTree, old_source_root: str) -> Lis
98
100
file_path = location .get ("file" )
99
101
file_path = file_path .replace (old_source_root , NEW_SOURCE_ROOT )
100
102
line_number = int (location .get ("line" ))
101
-
102
- suppressions .append (CppcheckSuppression (error_type = error_type , file_path = file_path , line_number = line_number ))
103
+ if error_type == "internalError" :
104
+ internal_errors .append (CppcheckSuppression (error_type = error_type , file_path = file_path , line_number = line_number ))
105
+ else :
106
+ suppressions .append (CppcheckSuppression (error_type = error_type , file_path = file_path , line_number = line_number ))
103
107
104
108
# Sort the suppressions by file name and line number.
105
109
suppressions .sort ()
110
+ internal_errors .sort ()
106
111
107
112
# Convert to strings and remove any duplicates.
108
113
suppression_strings = []
114
+
109
115
for suppression in suppressions :
110
116
suppression_string = suppression .suppression_string ()
111
117
if suppression_string not in suppression_strings :
112
118
suppression_strings .append (suppression_string )
113
119
120
+ # Group the internal errors together so they can be moved out of the suppressions list easily.
121
+ for internal_error in internal_errors :
122
+ suppression_string = internal_error .suppression_string ()
123
+ if suppression_string not in suppression_strings :
124
+ suppression_strings .append (suppression_string )
125
+
114
126
return suppression_strings
115
127
116
128
0 commit comments