MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / setReportType

Method setReportType

gui/resultstree.cpp:153–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153void ResultsTree::setReportType(ReportType reportType) {
154 mReportType = reportType;
155
156 mGuideline = createGuidelineMapping(reportType);
157
158 for (int i = 0; i < mModel->rowCount(); ++i) {
159 auto *fileItem = dynamic_cast<ResultItem*>(mModel->item(i, COLUMN_FILE));
160 if (!fileItem)
161 continue;
162 for (int j = 0; j < fileItem->rowCount(); ++j) {
163 QSharedPointer<ErrorItem>& errorItem = dynamic_cast<ResultItem*>(fileItem->child(j,0))->errorItem;
164 errorItem->guideline = getGuideline(mReportType, mGuideline, errorItem->errorId, errorItem->severity);
165 errorItem->classification = getClassification(mReportType, errorItem->guideline);
166 dynamic_cast<ResultItem*>(fileItem->child(j, COLUMN_FILE))->setIconFileName(severityToIcon(getSeverity(reportType, *errorItem)));
167 fileItem->child(j, COLUMN_CERT_LEVEL)->setText(errorItem->classification);
168 fileItem->child(j, COLUMN_CERT_RULE)->setText(errorItem->guideline);
169 fileItem->child(j, COLUMN_MISRA_CLASSIFICATION)->setText(errorItem->classification);
170 fileItem->child(j, COLUMN_MISRA_GUIDELINE)->setText(errorItem->guideline);
171 }
172 }
173
174 if (isAutosarMisraReport()) {
175 showColumn(COLUMN_MISRA_CLASSIFICATION);
176 showColumn(COLUMN_MISRA_GUIDELINE);
177 } else {
178 hideColumn(COLUMN_MISRA_CLASSIFICATION);
179 hideColumn(COLUMN_MISRA_GUIDELINE);
180 }
181
182 if (isCertReport()) {
183 showColumn(COLUMN_CERT_LEVEL);
184 showColumn(COLUMN_CERT_RULE);
185 } else {
186 hideColumn(COLUMN_CERT_LEVEL);
187 hideColumn(COLUMN_CERT_RULE);
188 }
189
190 if (mReportType == ReportType::normal) {
191 showColumn(COLUMN_SEVERITY);
192 } else {
193 hideColumn(COLUMN_SEVERITY);
194 }
195
196 refreshTree();
197}
198
199void ResultsTree::initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler)
200{

Callers 5

changeReportTypeMethod · 0.45
testReportTypeMethod · 0.45
testReportTypeIconMethod · 0.45
testGetGuidelineErrorMethod · 0.45

Calls 6

createGuidelineMappingFunction · 0.85
getSeverityFunction · 0.85
rowCountMethod · 0.80
setIconFileNameMethod · 0.80
getGuidelineFunction · 0.70
getClassificationFunction · 0.70

Tested by 4

testReportTypeMethod · 0.36
testReportTypeIconMethod · 0.36
testGetGuidelineErrorMethod · 0.36