| 500 | } |
| 501 | |
| 502 | void StdLogger::writeCheckersReport(const Suppressions& supprs) |
| 503 | { |
| 504 | // TODO: only necessary when we actually issue a checkers report? |
| 505 | if (!mCheckersFile.empty()) |
| 506 | { |
| 507 | std::ofstream fout(mCheckersFile); |
| 508 | for (const auto& c : mActiveCheckers) |
| 509 | { |
| 510 | fout << c << std::endl; |
| 511 | } |
| 512 | } |
| 513 | |
| 514 | bool summary, xmlReport, textReport; |
| 515 | |
| 516 | if (!mSettings.collectLogCheckers(&summary, &xmlReport, &textReport)) |
| 517 | return; |
| 518 | |
| 519 | CheckersReport checkersReport(mSettings, mActiveCheckers); |
| 520 | |
| 521 | // TODO: include in summary boolean |
| 522 | const auto& suppressions = supprs.nomsg.getSuppressions(); |
| 523 | const bool summarySuppressed = std::any_of(suppressions.cbegin(), suppressions.cend(), [](const SuppressionList::Suppression& s) { |
| 524 | return s.errorId == "checkersReport"; |
| 525 | }); |
| 526 | |
| 527 | if (summary && !summarySuppressed) { |
| 528 | ErrorMessage msg; |
| 529 | msg.severity = Severity::information; |
| 530 | msg.id = "checkersReport"; |
| 531 | |
| 532 | const int activeCheckers = checkersReport.getActiveCheckersCount(); |
| 533 | const int totalCheckers = checkersReport.getAllCheckersCount(); |
| 534 | |
| 535 | std::string what; |
| 536 | if (mCriticalErrors.empty()) |
| 537 | what = std::to_string(activeCheckers) + "/" + std::to_string(totalCheckers); |
| 538 | else |
| 539 | what = "There was critical errors"; |
| 540 | if (!xmlReport && !textReport) |
| 541 | what += " (use --checkers-report=<filename> to see details)"; |
| 542 | msg.setmsg("Active checkers: " + what); |
| 543 | |
| 544 | reportErr(msg); |
| 545 | } |
| 546 | |
| 547 | if (textReport) { |
| 548 | std::ofstream fout(mSettings.checkersReportFilename); |
| 549 | if (fout.is_open()) |
| 550 | fout << checkersReport.getReport(mCriticalErrors); |
| 551 | } |
| 552 | |
| 553 | if (xmlReport) { |
| 554 | reportErr(" </errors>\n"); |
| 555 | if (mSettings.safety) |
| 556 | reportErr(" <safety/>\n"); |
| 557 | if (mSettings.inlineSuppressions) |
| 558 | reportErr(" <inline-suppr/>\n"); |
| 559 | if (!suppressions.empty()) { |
no test coverage detected