@@ -259,6 +259,9 @@ namespace {
259259 if (!mSettings .outputFile .empty ()) {
260260 mErrorOutput = new std::ofstream (settings.outputFile );
261261 }
262+ if (!mSettings .buildDir .empty ()) {
263+ mCheckersFile = Path::join (settings.buildDir , " checkers.txt" );
264+ }
262265 }
263266
264267 ~StdLogger () override {
@@ -311,6 +314,22 @@ namespace {
311314 return mCtuInfo ;
312315 }
313316
317+ void readActiveCheckers () {
318+ std::ifstream fout (mCheckersFile );
319+ if (fout.is_open ())
320+ {
321+ std::set<std::string> activeCheckers;
322+ std::string line;
323+ // cppcheck-suppress accessMoved - FP
324+ while (std::getline (fout, line))
325+ {
326+ // cppcheck-suppress accessMoved - FP
327+ activeCheckers.emplace (std::move (line));
328+ }
329+ mActiveCheckers = std::move (activeCheckers);
330+ }
331+ }
332+
314333 private:
315334 /* *
316335 * Information about progress is directed here. This should be
@@ -375,6 +394,11 @@ namespace {
375394 * File metrics
376395 */
377396 std::vector<std::string> mFileMetrics ;
397+
398+ /* *
399+ * The file the cached active checkers are stored in
400+ */
401+ std::string mCheckersFile ;
378402 };
379403}
380404
@@ -465,6 +489,8 @@ int CppCheckExecutor::check_internal(const Settings& settings, Suppressions& sup
465489 for (auto i = mFiles .cbegin (); i != mFiles .cend (); ++i)
466490 fileNames.emplace_back (i->path ());
467491 AnalyzerInformation::writeFilesTxt (settings.buildDir , fileNames, settings.userDefines , mFileSettings );
492+
493+ stdLogger.readActiveCheckers ();
468494 }
469495
470496 if (!settings.checkersReportFilename .empty ())
@@ -522,6 +548,15 @@ int CppCheckExecutor::check_internal(const Settings& settings, Suppressions& sup
522548
523549void StdLogger::writeCheckersReport (const Suppressions& supprs)
524550{
551+ if (!mCheckersFile .empty ())
552+ {
553+ std::ofstream fout (mCheckersFile );
554+ for (const auto & c : mActiveCheckers )
555+ {
556+ fout << c << std::endl;
557+ }
558+ }
559+
525560 const bool summary = mSettings .safety || mSettings .severity .isEnabled (Severity::information);
526561 const bool xmlReport = mSettings .outputFormat == Settings::OutputFormat::xml && mSettings .xml_version == 3 ;
527562 const bool textReport = !mSettings .checkersReportFilename .empty ();
0 commit comments