Skip to content

Combine thread-safe logging (PR #8610) with OPENMS_LOG_* macro optimizations (PR #8582) - #8620

Merged
timosachsenberg merged 14 commits into
developfrom
logger_segfault
Jan 12, 2026
Merged

timosachsenberg merged 14 commits into
developfrom
logger_segfault

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Jan 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR combines two related logging improvements:

  1. Thread-safe logging from PR [FEATURE] Add thread-local logging to fix data races (issue #8596) #8610: Adds thread-local context to fix data races in LogStream, making logging safe for multi-threaded code
  2. OPENMS_LOG_ macro optimizations from PR perf: replace std::endl with '\n' in high-impact files to improve I/O performance #8582*: Replaces std::endl with '\n' in high-impact files to improve I/O performance

The previously closed PR #8582 failed due to logger-related issues. This branch demonstrates that with the thread-safe logging fixes from PR #8610, those changes now work correctly.

Test Results

  • 99% tests passed (2428/2437)
  • Only 9 failures, all related to external tools not installed (CometAdapter, ThermoRawFileParser, Doxygen)
  • All core OpenMS tests pass

Changes

  • Thread-local logging infrastructure (ThreadLogContext)
  • Integration with LogConfigHandler
  • std::endl → '\n' optimizations in 35 source files
  • Kept std::endl for error/warning messages to ensure immediate output

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Per-thread (thread-local) loggers introduced alongside global loggers for safer concurrent logging.
  • Refactor

    • Standardized log line endings to '\n' and consolidated console output into the centralized logging system to reduce unnecessary flushes and improve performance.
    • Added scoped guard to temporarily silence/restore log sinks for exception-safe suppression.
  • Documentation

    • Clarified thread-safety and global vs. thread-local logging guidance.
  • Tests

    • Updated tests to validate thread-local behavior and concurrent logging.

✏️ Tip: You can customize this high-level summary in your review settings.

claude and others added 7 commits January 4, 2026 21:13
… performance

Replace ~705 occurrences of std::endl with '\n' in 35 high-impact source files.

std::endl flushes the stream buffer after each newline, which is particularly
expensive on Windows console I/O. This change addresses issue #4854 by
reducing unnecessary stream flushing in logging and debug output paths.

Key files updated:
- FeatureFinderAlgorithmPicked.cpp (68 occurrences)
- PeakPickerIM.cpp (49 occurrences)
- Param.cpp (41 occurrences)
- TransitionTSVFile.cpp (38 occurrences)
- ClassTest.cpp (30 occurrences)
- Plus 30 additional high-impact files

This optimization should improve test execution times, especially in
debug mode on Windows where console I/O is significantly slower.
…utput

Selectively revert std::endl to '\n' replacement for error and warning
messages that should be immediately visible for debugging. This ensures
critical error output is flushed immediately while keeping '\n' for
high-frequency debug/info logging.

Files with reverted error messages:
- HyperScore.cpp: Error/Warning messages for spectrum validation
- Param.cpp: Parameter validation errors
- IndexedMzMLDecoder.cpp: File parsing errors
- FeatureFinderAlgorithmPicked.cpp: Algorithm errors
- MSNumpressCoder.cpp: Encoding exceptions
- File.cpp: File operation errors/warnings
- SwathFile.cpp: File loading warnings
- BayesianProteinInferenceAlgorithm.cpp: Protein annotation errors

This maintains the performance benefit for debug logging while ensuring
error messages are always visible even if the program crashes.
- ConsensusFeature.cpp: Replace remaining std::endl with '\n' in operator<<
- XQuestResultXMLFile.cpp: Replace std::cout with OPENMS_LOG_INFO for
  proper logging (lines 81 and 151)
- Param.cpp: Keep std::endl for OPENMS_LOG_WARN messages to ensure proper
  stream flushing (fixes Param_test SEGFAULT)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Implement thread-local LogStream instances to eliminate race conditions
that occur when multiple threads use OPENMS_LOG_* macros simultaneously.
The race conditions affected sync() method operations on shared buffers,
incomplete_line_ state, and log caches.

Key changes:
- Add ThreadLogContext class providing per-thread LogStream instances
- Add _TL (thread-local) and _LEGACY macro variants in LogStream.h
- Add OPENMS_THREADLOCAL_LOGGING CMake option (ON by default)
- Update LogStream_test to work with both modes
- Add comprehensive ThreadLogContext_test with multi-threaded tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Thread-local logging was not picking up stream configuration changes made
via LogConfigHandler or direct stream manipulation. This caused test failures
in Param_test and LogConfigHandler_test.

Changes:
- Add LogStreamBuf constructor to copy stream_list_ from source buffer
- Thread-local streams now copy initial config from global streams
- Add LogStream::flushIncomplete() to flush unterminated lines
- LogConfigHandler::setLogLevel() now flushes thread-local buffers
- Update tests to call ThreadLogContext::reset() after config changes
- Simplify LogStream_test OpenMP test to avoid stream lifetime issues

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Address reviewer feedback (cbielow) to simplify thread-local logging:

- Remove ThreadLogContext class entirely (~250 lines)
- Add 5 simple thread-local accessor functions:
  - getThreadLocalLogFatal()
  - getThreadLocalLogError()
  - getThreadLocalLogWarn()
  - getThreadLocalLogInfo()
  - getThreadLocalLogDebug()
- Remove OPENMS_THREADLOCAL_LOGGING CMake feature flag
- Remove legacy logging macros (always use thread-local now)
- Document restrictions: configure logging once at startup,
  before spawning threads

The thread-local streams copy stream_list_ from globals on first
access, so configuration propagates to new threads automatically.

Tests updated:
- LogConfigHandler_test uses global streams directly (tests what
  LogConfigHandler actually configures)
- LogStream_test uses thread-local accessors
- Removed ThreadLogContext_test

Net change: -660 lines (removed 789, added 129)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jan 9, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR introduces thread-local LogStream instances by copying global LogStreamBuf configurations per thread, adds LogStream::flushIncomplete() and LogStreamBuf accessors, introduces Logger::LogSinkGuard (RAII) for temporarily removing/reinserting sinks, updates logging macros to use thread-local getters while exposing global accessors, and replaces many std::endl uses with '\n' across the codebase.

Changes

Cohort / File(s) Summary
Core logging infrastructure
src/openms/include/OpenMS/CONCEPT/LogStream.h, src/openms/source/CONCEPT/LogStream.cpp
Added LogStreamBuf(LogStreamBuf* source_buf, Colorizer* col = nullptr); exposed getStreamList_() (mutable/const); added flushIncomplete() to LogStreamBuf and LogStream; introduced thread-local LogStreams copying global buffer destinations; added getGlobalLog*() and getThreadLocalLog*() accessors.
Log sink RAII & guards
src/openms/include/OpenMS/CONCEPT/LogStream.h, src/openms/source/CONCEPT/LogStream.cpp, usages across repo
Introduced Logger::LogSinkGuard (RAII) to temporarily remove and reinsert sinks safely; callsites/tests updated to use guard for exception-safe suppression/restoration.
Macros & compatibility
src/openms/include/OpenMS/CONCEPT/LogStream.h, various headers
Updated OPENMS_LOG_* macros to use thread-local getters; added global accessors and preserved global-style aliases for compatibility; updated docblocks describing global vs thread-local behavior.
Tests updated for TLS logging
src/tests/class_tests/openms/source/LogStream_test.cpp, .../LogConfigHandler_test.cpp, .../Param_test.cpp
Tests refactored to exercise thread-local streams, LogSinkGuard semantics, and parallel logging; some tests now explicitly use global accessors where intended.
Callsite migrations to global accessors
multiple files under src/... (applications, GUI, TOPP, format, featurefinder, etc.)
Replaced direct OpenMS_Log_* / compile-time logger flags with getGlobalLog*() in parameter updates, defaults, and suppression code paths.
Mass newline normalization (endl → '\n')
Numerous src/openms/source/... files
Replaced many std::endl usages with '\n' in OPENMS_LOG_* and other outputs; one std::cout → OPENMS_LOG_INFO change in XQuestResultXMLFile; no algorithmic changes.

Sequence Diagram(s)

sequenceDiagram
    participant Caller as Caller code
    participant Macro as OPENMS_LOG_* macro
    participant TLS as Thread-local getter
    participant GlobalBuf as Global LogStreamBuf
    participant ThreadStream as Thread-local LogStream
    participant Sink as Output sink(s)

    Caller->>Macro: OPENMS_LOG_INFO << "msg"
    Macro->>TLS: getThreadLocalLogInfo()
    TLS->>GlobalBuf: (on first use) copy stream_list_/config
    GlobalBuf-->>ThreadStream: initialize per-thread LogStreamBuf
    Macro->>ThreadStream: operator<< "msg"
    ThreadStream->>Sink: write (possibly buffered) to configured sinks
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Suggested labels

enhancement, Review effort [1-5]: 3

Suggested reviewers

  • jpfeuffer
  • cbielow

Poem

🐰 I copied buffers, one per thread,
No more races when logs are spread,
Endls hopped out, newlines now sing,
Guards tuck sinks back—safe everything,
A rabbit cheers: "Nice logging bed!"

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: thread-safe logging (PR #8610) and OPENMS_LOG_* macro optimizations (PR #8582), representing the core objectives of this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Note

Due to the large number of review comments, Critical, Major severity comments were prioritized as inline comments.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (18)
src/openms/source/ANALYSIS/ID/PeptideProteinResolution.cpp (2)

21-40: operator<< (ConnectedComponent) likely missing a final newline after “Peptides” block

You added '\n' after the protein list (Line 30), but the peptides list doesn’t end with a newline before returning (Line 39). If this operator is used standalone (not immediately followed by another newline), output can end up merged with the next log message.

Proposed tweak
@@
     os << "Peptides: ";
@@
     for (std::set<Size>::const_iterator pep_it = conn_comp.pep_indices.begin();
           pep_it != conn_comp.pep_indices.end();
           ++pep_it)
     {
       os << *pep_it << ",";
     }
-
+    os << '\n';
     return os;    
   }

708-714: Good: converted fatal/debug logs to '\n', but file still contains std::endl elsewhere

These hunks are consistent, but resolveGraph() still uses endl in several INFO/debug statements (e.g., Lines 355-357, 393-396, 418-423). That undermines the PR-wide “no implicit flush” goal and violates the local guideline.

Suggested follow-up diff (representative)
-        << endl;
+        << '\n';
@@
-          OPENMS_LOG_INFO << "found group: " << endl;
+          OPENMS_LOG_INFO << "found group: " << '\n';
@@
-          OPENMS_LOG_INFO << endl << "Processing ..." << endl;
+          OPENMS_LOG_INFO << '\n' << "Processing ..." << '\n';
As per coding guidelines, avoid `std::endl`.

Also applies to: 724-731

src/openms/source/CONCEPT/ClassTest.cpp (2)

216-225: Avoid direct std::cout here; use the existing test output stream abstraction.
Line 222 introduces std::cout, while the file otherwise relies on stdcout (and/or test redirection). This can bypass expected capture/redirect behavior. As per coding guidelines, avoid direct std::cout.

Proposed fix
@@
       if (!newline)
       {
         newline = true;
-          std::cout << '\n';
+          stdcout << '\n';
       }

241-362: Remove leftover std::endl (and the duplicate newline) in validate().
Lines 355 and 359 still flush and currently emit two newlines (std::endl + '\n'). As per coding guidelines, avoid std::endl.

Proposed fix
@@
         if (passed_all)
         {
-          std::cout << ": passed" << std::endl << '\n';
+          std::cout << ": passed\n";
         }
         else
         {
-          std::cout << ": failed" << std::endl << '\n';
+          std::cout << ": failed\n";
         }
src/openms/source/FORMAT/SwathFile.cpp (2)

32-118: Replace std::cout/std::cerr with OpenMS logging macros (esp. under OpenMP).
Line 52 (and nearby) prints via std::cout inside an OpenMP critical block; this bypasses the logging system and can still interleave output. As per coding guidelines, avoid direct std::cout/std::cerr.

Example adjustment
@@
       {
-        std::cout << "Loading file " << i << " with name " << file_list[i] << " using readoptions " << readoptions << '\n';
+        OPENMS_LOG_INFO << "Loading file " << i << " with name " << file_list[i] << " using readoptions " << readoptions << '\n';
       }
@@
       if (exp->getSpectra()[0].getPrecursors().empty())
       {
-        std::cout << "NOTE: File " << file_list[i] << "\n does not have any precursors - I will assume it is the MS1 scan." << '\n';
+        OPENMS_LOG_WARN << "NOTE: File " << file_list[i]
+                        << " does not have any precursors - assuming it is the MS1 scan." << '\n';
         ms1 = true;
       }

120-188: Same issue in loadMzML(): use OPENMS_LOG_* instead of std::cout.
Lines 127, 135, and 141-143 introduce/keep std::cout for status messages; please route through OPENMS_LOG_INFO (or OPENMS_LOG_DEBUG if too verbose by default). As per coding guidelines, avoid direct std::cout.

src/openms/source/ANALYSIS/OPENSWATH/TransitionTSVFile.cpp (1)

1376-1393: Don’t write to std::cerr right before throwing—use OPENMS_LOG_ERROR or rely on the exception.
Line 1391 prints an error message to stderr and then throws; that can duplicate output and bypass logging configuration. As per coding guidelines, avoid direct std::cerr.

Proposed fix
@@
       else
       {
         OPENMS_LOG_DEBUG << "Invalid sequence when parsing '" << tr_it->FullPeptideName << "'" << '\n';
-        std::cerr << "Error while reading file (use 'force_invalid_mods' parameter to override): " << e.what() << '\n';
+        OPENMS_LOG_ERROR << "Error while reading file (use 'force_invalid_mods' parameter to override): " << e.what() << '\n';
         throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
             "Invalid input, cannot parse: " + tr_it->FullPeptideName);
       }
src/openms/source/ANALYSIS/OPENSWATH/PeakPickerChromatogram.cpp (1)

64-105: Use OPENMS_LOG_* instead of std::cerr for the overlap error.
Line 304 prints to std::cerr; per coding guidelines, route through OpenMS logging (likely OPENMS_LOG_ERROR or OPENMS_LOG_WARN).

Proposed fix
@@
         if (new_left_border < new_right_border)
         {
-          std::cerr << "Something went wrong, peaks are still overlapping!" << " - new left border " << new_left_border << " vs " << new_right_border << " -- will take the mean" << '\n';
+          OPENMS_LOG_ERROR << "Something went wrong, peaks are still overlapping!"
+                           << " - new left border " << new_left_border
+                           << " vs " << new_right_border
+                           << " -- will take the mean" << '\n';
           new_left_border = (new_left_border + new_right_border) / 2;
           new_right_border = (new_left_border + new_right_border) / 2;
         }

Also applies to: 204-208, 259-316

src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp (1)

1423-1427: Finish the std::endl removal in error logs (two remaining).

These are easy to miss, but they still force flushes. As per coding guidelines, ...

Proposed diff
-              OPENMS_LOG_ERROR << "Error: Missing or invalid protein reference for peptide '" << pepi << "': '" << pe->getProteinAccession() << "' - skipping." << endl;
+              OPENMS_LOG_ERROR << "Error: Missing or invalid protein reference for peptide '" << pepi << "': '"
+                               << pe->getProteinAccession() << "' - skipping." << '\n';
               continue;
-              OPENMS_LOG_ERROR << "Error: Missing or invalid protein reference for peptide '" << pepi << "': '" << pe->getProteinAccession() << "' - skipping." << endl;
+              OPENMS_LOG_ERROR << "Error: Missing or invalid protein reference for peptide '" << pepi << "': '"
+                               << pe->getProteinAccession() << "' - skipping." << '\n';
               continue;

Also applies to: 1971-1975

src/openms/source/ANALYSIS/OPENSWATH/MRMDecoy.cpp (1)

140-157: Replace std::cout debug prints with OpenMS logging macros (even under DEBUG_MRMDECOY).

std::cout violates the repo-wide “no std::cout/std::cerr” rule and bypasses the thread-local logging infrastructure this PR is adding. As per coding guidelines and learnings, please route this through OPENMS_LOG_DEBUG (or a dedicated OPENMS_LOG_* macro gated by DEBUG_MRMDECOY).

Proposed fix
 #ifdef DEBUG_MRMDECOY
-    std::cout << " shuffle peptide " << peptide.sequence << '\n';
+    OPENMS_LOG_DEBUG << "shuffle peptide " << peptide.sequence << '\n';
     seed = 41;
 #endif
 ...
 #ifdef DEBUG_MRMDECOY
     for (Size j = 0; j < peptide.mods.size(); j++)
     {
-      std::cout << " position after shuffling " << peptide.mods[j].location << " mass difference " << peptide.mods[j].mono_mass_delta << '\n';
+      OPENMS_LOG_DEBUG << "position after shuffling " << peptide.mods[j].location
+                       << " mass difference " << peptide.mods[j].mono_mass_delta << '\n';
     }
 #endif
src/openms/source/FEATUREFINDER/ElutionPeakDetection.cpp (2)

265-287: Avoid std::cout in debug blocks; use OPENMS_LOG_DEBUG (or OPENMS_LOG_INFO) instead.
Even under DEBUG_EPD, this bypasses the logging system and violates the repo rule against std::cout. As per coding guidelines and learnings.

Proposed fix (pattern)
 #ifdef DEBUG_EPD
-        std::cout << "findLocalExtrema: Identified potential minimum " << '\n';
+        OPENMS_LOG_DEBUG << "findLocalExtrema: Identified potential minimum" << '\n';
 ...
-        std::cout << "    Distance: min " << min_dist << ", left: " << left_dist << ", right: " << right_dist << '\n';
+        OPENMS_LOG_DEBUG << "    Distance: min " << min_dist << ", left: " << left_dist
+                         << ", right: " << right_dist << '\n';
 #endif

Also applies to: 393-416


364-377: Fix unconditional std::cout and potential out-of-bounds access in filterByPeakWidth().
Line 375 can crash if filt_mtraces is empty, and it also prints to stdout unconditionally (violating logging guidelines and likely polluting tool output). As per coding guidelines and learnings.

Proposed fix
-    std::cout << "pw low: " << filt_mtraces[0].estimateFWHM(true) << " " << " pw high: " << filt_mtraces[filt_mtraces.size() - 1].estimateFWHM(true) << '\n';
+    if (!filt_mtraces.empty())
+    {
+      OPENMS_LOG_DEBUG << "pw low: " << filt_mtraces.front().estimateFWHM(true)
+                       << " pw high: " << filt_mtraces.back().estimateFWHM(true) << '\n';
+    }
src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp (1)

191-221: Fix UB: don’t dereference modifiable_nterm/cterm.begin() when the set is empty.
The else branches can execute when the set is empty (because the if condition is !empty() && matches), but still log (*begin()), which is undefined behavior.

Proposed fix
           if (*pos_it == 0)
           {
             // Check first to make sure ending residue is NTerm modifiable
-            if ( !modifiable_nterm.empty() && (temp_sequence[0].getOneLetterCode() == OpenMS::String((*modifiable_nterm.begin())->getOrigin()) || (*modifiable_nterm.begin())->getOrigin() == 'X') ) 
+            if (!modifiable_nterm.empty() &&
+                (temp_sequence[0].getOneLetterCode() == OpenMS::String((*modifiable_nterm.begin())->getOrigin()) ||
+                 (*modifiable_nterm.begin())->getOrigin() == 'X'))
             {
               temp_sequence.setNTerminalModification(modification);
             } 
             else 
             {
-              OPENMS_LOG_DEBUG << "[addModificationsSequences_] Skipping addition of N-Term " << OpenMS::String((*modifiable_nterm.begin())->getId()) <<
-                                   " to last residue (" << temp_sequence[temp_sequence.size() - 1].getOneLetterCode() << ") of peptide " << temp_sequence.toUniModString() << 
-                                   " , because it does not match viable N-Term residue specificity (" <<
-                                   OpenMS::String((*modifiable_nterm.begin())->getOrigin()) << ") in ModificationDB." << '\n';
+              const String mod_id = modifiable_nterm.empty() ? "n/a" : String((*modifiable_nterm.begin())->getId());
+              const String origin = modifiable_nterm.empty() ? "n/a" : String((*modifiable_nterm.begin())->getOrigin());
+              OPENMS_LOG_DEBUG << "[addModificationsSequences_] Skipping addition of N-Term " << mod_id
+                               << " to first residue (" << temp_sequence[0].getOneLetterCode()
+                               << ") of peptide " << temp_sequence.toUniModString()
+                               << " , because it does not match viable N-Term residue specificity ("
+                               << origin << ") in ModificationDB." << '\n';
               skip_invalid_mod_seq = true;
             }
           }
           else if (*pos_it == temp_sequence.size() + 1)
           {
             // Check first to make sure ending residue is CTerm modifiable
             if ( !modifiable_cterm.empty() && (temp_sequence.toUnmodifiedString().back() == (*modifiable_cterm.begin())->getOrigin() || (*modifiable_cterm.begin())->getOrigin() == 'X') )
             {
               temp_sequence.setCTerminalModification(modification);
             } 
             else 
             {
-              OPENMS_LOG_DEBUG << "[addModificationsSequences_] Skipping addition of C-Term " << OpenMS::String((*modifiable_cterm.begin())->getId()) <<
+              const String mod_id = modifiable_cterm.empty() ? "n/a" : String((*modifiable_cterm.begin())->getId());
+              const String origin = modifiable_cterm.empty() ? "n/a" : String((*modifiable_cterm.begin())->getOrigin());
+              OPENMS_LOG_DEBUG << "[addModificationsSequences_] Skipping addition of C-Term " << mod_id <<
                                    " to last residue (" << temp_sequence.toUnmodifiedString().back() << ") of peptide " << temp_sequence.toUniModString() << 
                                    " , because it does not match viable C-Term residue specificity (" <<
-                                   OpenMS::String((*modifiable_cterm.begin())->getOrigin()) << ") in ModificationDB." << '\n';
+                                   origin << ") in ModificationDB." << '\n';
               skip_invalid_mod_seq = true;
             }
           }
src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp (3)

1622-1634: Fix out-of-bounds write in calculateEstimatedQVal_ (reserve != resize).
estimatedFDR[j] = ... is UB because the vector is only reserved, not sized.

Proposed fix
     std::vector<double> estimatedFDR;
-    estimatedFDR.reserve(scores_labels.size());
+    estimatedFDR.resize(scores_labels.size());
 ...
     for (size_t j = 0; j < scores_labels.size(); ++j)
     {
       sum += scores_labels[j].first;
       estimatedFDR[j] = sum / (double(j)+1.0);
     }

142-148: Remove remaining std::endl from OPENMS_LOG_FATAL_ERROR (use '\n' and explicit flush if needed).
std::endl is disallowed by the repo guidelines; if the intent is “flush before throw”, prefer '\n' << std::flush (or the new log flush helper if available). As per coding guidelines.

Proposed fix
-              OPENMS_LOG_FATAL_ERROR << "Meta value 'target_decoy' does not exists, reindex the idXML file with 'PeptideIndexer' first (run-id='" << it->getIdentifier() << ", rank=" << i + 1 << " of " << it->getHits().size() << ")!" << endl;
+              OPENMS_LOG_FATAL_ERROR << "Meta value 'target_decoy' does not exists, reindex the idXML file with 'PeptideIndexer' first (run-id='" << it->getIdentifier() << ", rank=" << i + 1 << " of " << it->getHits().size() << ")!"
+                                    << '\n' << std::flush;
...
-                OPENMS_LOG_FATAL_ERROR << "Meta value 'target_decoy' does not exists, reindex the idXML file with 'PeptideIndexer' (run-id='" << it->getIdentifier() << ", rank=" << i + 1 << " of " << hits.size() << ")!" << endl;
+                OPENMS_LOG_FATAL_ERROR << "Meta value 'target_decoy' does not exists, reindex the idXML file with 'PeptideIndexer' (run-id='" << it->getIdentifier() << ", rank=" << i + 1 << " of " << hits.size() << ")!"
+                                      << '\n' << std::flush;
...
-          OPENMS_LOG_FATAL_ERROR << "Meta value 'target_decoy' does not exist, reindex the idXML file with 'PeptideIndexer' first (run-id='" 
-            << it->getIdentifier() << ")!" << endl;
+          OPENMS_LOG_FATAL_ERROR << "Meta value 'target_decoy' does not exist, reindex the idXML file with 'PeptideIndexer' first (run-id='"
+                                << it->getIdentifier() << ")!" << '\n' << std::flush;

Also applies to: 255-261, 500-505


1158-1164: Likely bug: chargeRange.second uses .first instead of .second.
This looks like it will compute an incorrect charge range when aggregating runs.

Proposed fix
-        chargeRange.second = std::max(run.getSearchParameters().getChargeRange().first, chargeRange.second);
+        chargeRange.second = std::max(run.getSearchParameters().getChargeRange().second, chargeRange.second);
src/openms/source/ANALYSIS/ID/PeptideIndexing.cpp (2)

575-577: Replace std::cout with OPENMS logging macro.

Direct use of std::cout violates the coding guideline. Use OPENMS_LOG_INFO or OPENMS_LOG_DEBUG for timing and memory usage messages depending on the desired verbosity level.

Proposed fix
-    std::cout << "Merge took: " << s.toString() << "\n";
+    OPENMS_LOG_INFO << "Merge took: " << s.toString() << "\n";
     mu.after();
-    std::cout << mu.delta("Aho-Corasick") << "\n\n";
+    OPENMS_LOG_INFO << mu.delta("Aho-Corasick") << "\n\n";

As per coding guidelines, never use std::cout or std::cerr directly; use OpenMS logging macros instead.


1115-1115: Replace cout with OPENMS logging macro.

Direct use of bare cout (without std:: namespace qualification) violates the coding guideline. Use OPENMS_LOG_INFO or OPENMS_LOG_DEBUG instead.

Proposed fix
-  cout << p2;
+  OPENMS_LOG_INFO << p2;

As per coding guidelines, never use std::cout or std::cerr directly; use OpenMS logging macros instead.

🤖 Fix all issues with AI agents
In @src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp:
- Around line 1698-1701: Replace all std::cerr debug prints guarded by
FALSE_DISCOVERY_RATE_DEBUG in FalseDiscoveryRate.cpp with the OPENMS logging
macro: use OPENMS_LOG_DEBUG to emit the same message (including last_score,
decoys, j and the computed fdr) so the debug output integrates with OpenMS
logging and thread-local settings; update the three occurrences (the block using
FALSE_DISCOVERY_RATE_DEBUG around the "Recording score: ..." line and the
similar blocks around lines noted as 1742-1745 and 1753-1756) to call
OPENMS_LOG_DEBUG with a single formatted message instead of std::cerr.

In @src/openms/source/ANALYSIS/MAPMATCHING/PoseClusteringAffineSuperimposer.cpp:
- Around line 835-847: Replace direct std::cout warnings in
PoseClusteringAffineSuperimposer (the blocks printing slope/shift and
param_.getValue("max_scaling"/"max_shift")) with OPENMS_LOG_WARN so warnings go
through the OpenMS logging system; change the two std::cout statements per block
to a single OPENMS_LOG_WARN stream that concatenates the same text and values
(omit manual '\n'), and ensure the OpenMS logging header is included if not
already.

In @src/openms/source/ANALYSIS/OPENSWATH/IonMobilityScoring.cpp:
- Around line 94-101: Replace the std::cout in IonMobilityScoring.cpp with
OpenMS logging: use OPENMS_LOG_ERROR (or appropriate OPENMS_LOG_* level) to emit
the same diagnostic including im_grid[k], pr_it->getMobility(), and any context
(eps) before throwing; keep the existing throw Exception::OutOfRange(__FILE__,
__LINE__, OPENMS_PRETTY_FUNCTION) so the exception context remains unchanged and
no direct std::cout/std::cerr calls remain (locate the check using im_grid,
pr_it, eps and the throw to make the change).

In @src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp:
- Around line 402-404: Replace the stray std::cout debug prints in
SwathMapMassCorrection.cpp with the OpenMS logging macro: use OPENMS_LOG_DEBUG
to emit the same message content (including im_regression_params[0],
im_regression_params[1], im_regression_params[2]) so the output goes through the
logging system; update both occurrences (the one printing "# im regression
parameters: Y = ..." near im_regression_params and the similar print at lines
~725-726) to use OPENMS_LOG_DEBUG with a single formatted message string. Ensure
there is no use of std::cout left for these diagnostics.

In @src/openms/source/DATASTRUCTURES/Param.cpp:
- Line 597: The code prints parameter assignment using std::cerr; replace that
with the OpenMS logging macros (e.g. OPENMS_LOG_INFO) so logging follows the
project infrastructure: change the line using std::cerr with a call like
OPENMS_LOG_INFO << "Setting " << prefix2 + it.getName() << " to " << it->value
<< std::endl; and add the required include for the OpenMS log stream
(LogStream.h) if not already present; choose OPENMS_LOG_WARN/DEBUG instead of
INFO only if the message semantically represents a warning or debug output.
- Line 190: Replace the direct std::cerr usage in ParamNode (the error message
"Error ParamNode name must not contain ':' characters!") with the OpenMS logging
macro; use OPENMS_LOG_WARN (or another appropriate OPENMS_LOG_* level) to emit
the same message so it integrates with the OpenMS logging system and coding
guidelines, updating the statement where the string is printed to call
OPENMS_LOG_WARN << "Error ParamNode name must not contain ':' characters!" <<
std::endl; (ensure the OpenMS logging header is included if not already).
🟡 Minor comments (15)
src/openms/source/ANALYSIS/OPENSWATH/MRMScoring.cpp-331-331 (1)

331-331: Fix undefined variable references in debug output.

Several debug statements reference variables that are not in scope:

  • Line 331: Calls xcorr_contrast_matrix_max_peak_getValue(i, j) — this function does not appear to exist; likely a typo.
  • Line 379: References xcorr_precursor_contrast_matrix_[i][j] where j is undefined (the loop only iterates over i).
  • Line 404: Same issue — references xcorr_precursor_contrast_matrix_[i][j] with undefined j.

These appear to be pre-existing bugs in the debug code, but should be corrected for code clarity.

Also applies to: 379-379, 404-404

src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp-405-405 (1)

405-405: Double newline introduced.

The string literal ends with \n and is followed by << '\n', resulting in two newlines. Remove one.

Proposed fix
-    OPENMS_LOG_DEBUG << "annotateSpectra(): (input size: " << spectra.size() << ") (annotated spectra: " << annotated_spectra.size() << ")\n" << '\n';
+    OPENMS_LOG_DEBUG << "annotateSpectra(): (input size: " << spectra.size() << ") (annotated spectra: " << annotated_spectra.size() << ")\n";
src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp-814-814 (1)

814-814: Remove std::endl (also has typo with space).

This line uses std:: endl (note the typo with space) which violates coding guidelines. If a leading newline is intentional, use '\n' instead.

Proposed fix
-      OPENMS_LOG_WARN << std:: endl << warn_msg << '\n';
+      OPENMS_LOG_WARN << '\n' << warn_msg << '\n';
src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp-390-390 (1)

390-390: Remove residual std::endl.

This line still contains std::endl alongside '\n', resulting in a double newline and an unnecessary flush. Per coding guidelines, std::endl should never be used.

Proposed fix
-          OPENMS_LOG_DEBUG << " (target_rt: " << target_rt << ") (target_mz: " << target_mz << ")" << std::endl << '\n';
+          OPENMS_LOG_DEBUG << " (target_rt: " << target_rt << ") (target_mz: " << target_mz << ")" << '\n';
src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp-484-485 (1)

484-485: Double newline introduced.

Same issue as line 405: the string ends with \n and is followed by << '\n'.

Proposed fix
     OPENMS_LOG_DEBUG << "pickSpectrum(): " << spectrum.getName() << " (input size: " <<
-      spectrum.size() << ") (picked: " << picked_spectrum.size() << ")\n" << '\n';
+      spectrum.size() << ") (picked: " << picked_spectrum.size() << ")\n";
src/openms/source/FORMAT/HANDLERS/IndexedMzMLDecoder.cpp-113-113 (1)

113-113: Fix malformed comment.

Line 113 contains a comment with code syntax remnants (" << '\n'), which appears to be leftover from editing. This should either be removed or corrected to be a proper comment without code fragments.

🧹 Proposed fix
-      // Warning: Index takes up more than 10 % of the whole file, please check your input file." << '\n';

If the warning message is still relevant, rewrite it as a proper comment:

+      // Note: Index takes up more than 10% of the whole file.

Otherwise, simply remove the line.

src/openms/source/FORMAT/XQuestResultXMLFile.cpp-81-83 (1)

81-83: Replace remaining std::endl in OPENMS_LOG_INFO (use '\n').

Right now these two lines still force a flush. As per coding guidelines, ...

Proposed diff
-    OPENMS_LOG_INFO << "Writing spec.xml to " << out_file << std::endl;
+    OPENMS_LOG_INFO << "Writing spec.xml to " << out_file << '\n';
-    OPENMS_LOG_INFO << "Writing spec.xml to " << out_file << std::endl;
+    OPENMS_LOG_INFO << "Writing spec.xml to " << out_file << '\n';

Also applies to: 151-153

src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp-260-265 (1)

260-265: Fix accidental << true in “Used maps” debug logging.

<< m.ms1 << true prints an extra constant and reads like a typo. As per coding guidelines, ...

Proposed diff
-            OPENMS_LOG_DEBUG << " -- Used maps " << m.lower << " to " << m.upper << " MS1 : " << m.ms1 << true << '\n';
+            OPENMS_LOG_DEBUG << " -- Used maps " << m.lower << " to " << m.upper << " MS1: " << m.ms1 << '\n';

Also applies to: 347-351

src/openms/source/ANALYSIS/OPENSWATH/OpenSwathWorkflow.cpp-564-564 (1)

564-564: Replace std::cerr with OPENMS logging macro.

Direct use of std::cerr violates the coding guideline. Use OPENMS_LOG_ERROR for error messages.

Proposed fix
-      std::cerr << "Setting -pasef and -matching_window_only flags simultaneously is not currently supported." << '\n';
+      OPENMS_LOG_ERROR << "Setting -pasef and -matching_window_only flags simultaneously is not currently supported." << '\n';

As per coding guidelines, never use std::cout or std::cerr directly; use OpenMS logging macros instead.

src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp-446-447 (1)

446-447: Replace std::cout with OPENMS logging macro.

Direct use of std::cout violates the coding guideline. Use OPENMS_LOG_WARN for warning messages to maintain consistency with line 298 which correctly uses OPENMS_LOG_WARN.

Proposed fix
-          std::cout << "Warning: Loopy belief propagation encountered a problem in a connected component. Skipping"
-                      "inference there." << '\n';
+          OPENMS_LOG_WARN << "Warning: Loopy belief propagation encountered a problem in a connected component. Skipping"
+                      " inference there." << '\n';

As per coding guidelines, never use std::cout or std::cerr directly; use OpenMS logging macros instead.

src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp-454-454 (1)

454-454: Replace std::cout with OPENMS logging macro.

Direct use of std::cout violates the coding guideline. Use OPENMS_LOG_WARN for warning messages to maintain consistency with the rest of the file.

Proposed fix
-        std::cout << "Skipped cc with only one type (proteins or peptides)" << '\n';
+        OPENMS_LOG_WARN << "Skipped cc with only one type (proteins or peptides)" << '\n';

As per coding guidelines, never use std::cout or std::cerr directly; use OpenMS logging macros instead.

src/openms/source/ANALYSIS/OPENSWATH/OpenSwathWorkflow.cpp-522-522 (1)

522-522: Replace std::cout with OPENMS logging macro.

Direct use of std::cout violates the coding guideline. Use OPENMS_LOG_INFO for informational messages.

Proposed fix
-    std::cout << "Will analyze " << transition_exp.transitions.size() << " transitions in total." << '\n';
+    OPENMS_LOG_INFO << "Will analyze " << transition_exp.transitions.size() << " transitions in total." << '\n';

As per coding guidelines, never use std::cout or std::cerr directly; use OpenMS logging macros instead.

src/openms/source/ANALYSIS/OPENSWATH/OpenSwathWorkflow.cpp-427-427 (1)

427-427: Replace std::cerr with OPENMS logging macro.

Direct use of std::cerr violates the coding guideline. Use OPENMS_LOG_WARN instead for warning messages.

Proposed fix
-          std::cerr << " - Warning: Detected " << nr_empty_chromatograms << " empty chromatograms. Will skip them!" << '\n';
+          OPENMS_LOG_WARN << " - Warning: Detected " << nr_empty_chromatograms << " empty chromatograms. Will skip them!" << '\n';

As per coding guidelines, never use std::cout or std::cerr directly; use OpenMS logging macros instead.

src/openms/source/ANALYSIS/OPENSWATH/OpenSwathWorkflow.cpp-649-656 (1)

649-656: Replace std::cout with OPENMS logging macro.

Direct use of std::cout violates the coding guideline. Use OPENMS_LOG_INFO for informational messages about threading configuration.

Proposed fix
-      std::cout << "Setting up nested loop with " << std::min(threads_outer_loop_, omp_get_max_threads()) << " threads out of "<< omp_get_max_threads() << '\n';
+      OPENMS_LOG_INFO << "Setting up nested loop with " << std::min(threads_outer_loop_, omp_get_max_threads()) << " threads out of "<< omp_get_max_threads() << '\n';
       omp_set_nested(1);
       omp_set_dynamic(0);
       omp_set_num_threads(std::min(threads_outer_loop_, omp_get_max_threads()) ); // use at most threads_outer_loop_ threads here
     }
     else
     {
-      std::cout << "Use non-nested loop with " << total_nr_threads << " threads." << '\n';
+      OPENMS_LOG_INFO << "Use non-nested loop with " << total_nr_threads << " threads." << '\n';

As per coding guidelines, never use std::cout or std::cerr directly; use OpenMS logging macros instead.

src/openms/source/CONCEPT/LogStream.cpp-51-63 (1)

51-63: Correct misleading comment about stream_list_ sharing.

The header file documentation (lines 107-109) correctly states that thread-local LogStreams copy stream_list_ and "start with the same initial configuration as the global LogStream instances," which accurately describes the intentional design. However, line 616 contains a misleading comment stating streams "share the stream_list_ (output destinations) with the global instance," which contradicts the actual behavior—they copy it at construction time, not share it dynamically.

Update the comment at line 616 to clarify that thread-local streams receive a copy of the stream list at initialization, not a shared reference to future changes.

🧹 Nitpick comments (19)
src/openms/source/ANALYSIS/OPENSWATH/MRMScoring.cpp (1)

209-209: Recommend migrating std::cout debug output to OpenMS logging macros (deferred recommendation).

The changes correctly replace std::endl with '\n' for I/O performance, aligning with the PR objectives. However, the underlying code violates the coding guideline that prohibits direct use of std::cout or std::cerr; instead, you should use OpenMS logging macros like OPENMS_LOG_INFO, OPENMS_LOG_DEBUG, etc.

While most of these are debug statements within #ifdef MRMSCORING_TESTING blocks, line 616 is part of general testing logic outside the debug guard and should prioritize migration.

Consider opening a follow-up issue to systematically replace these std::cout statements with appropriate OpenMS logging macros across the file.

Also applies to: 264-264, 292-292, 303-303, 311-311, 331-331, 353-353, 379-379, 404-404, 428-428, 480-480, 489-489, 616-616, 848-848, 857-857

src/openms/source/DATASTRUCTURES/Param.cpp (1)

247-261: Commented-out debug code should be removed.

Lines 247, 253, 261, 304, 322, 366, 368, 375, 386, 390, 406, 569, 641, 642, 881, 1514, 1519, 1528, 1542, 1546, 1552, and 1553 contain commented-out debug output (via //cout, //std::cerr, or //std::cout). These should be removed rather than retained in the codebase, as they represent dead code and reduce maintainability. If debugging is needed, proper logging macros should be used instead.

Consider removing all commented-out debug statements. If temporary debugging is required during development, use proper OpenMS logging macros with appropriate log levels (e.g., OPENMS_LOG_DEBUG) and manage log levels at runtime rather than leaving comments in production code.

Also applies to: 304-390, 569-569, 641-642, 881-881, 1514-1553

src/openms/source/FORMAT/MSNumpressCoder.cpp (3)

191-195: Approve std::endl → '\n' replacement, but convert debug output to use OpenMS logging macros.

The replacement of std::endl with '\n' aligns with the PR objectives for reducing flushing overhead. However, these debug statements use std::cout directly, which violates the coding guideline requiring OpenMS logging macros instead. Since the PR is already modifying these lines, consider converting them to use OPENMS_LOG_DEBUG or similar.

♻️ Example refactor using OpenMS logging

Instead of:

std::cout << "encodeNPRaw: numpressed array with with length " << numpressed.size() << '\n';

Use:

OPENMS_LOG_DEBUG("encodeNPRaw: numpressed array with with length " << numpressed.size());

This applies to all debug statements in NUMPRESS_DEBUG blocks.

Based on coding guidelines, which require using OpenMS logging mechanisms.


222-250: Convert error tolerance check debug output to OpenMS logging.

Similar to the previous comment: while the '\n' replacements are correct per PR objectives, the underlying use of std::cout for debug output violates the coding guidelines. Consider refactoring these conditional debug statements within the error tolerance loop to use OpenMS logging macros.


297-365: Convert decodeNPInternal_ debug output to OpenMS logging.

The std::cout statements in the NUMPRESS_DEBUG blocks at lines 297–300 and 362–365 should use OpenMS logging macros per coding guidelines. Since these lines are being modified by the PR, it's a good opportunity to address this pre-existing guideline violation.

Based on coding guidelines requiring OpenMS logging mechanisms.

src/openms/source/CONCEPT/FuzzyStringComparator.cpp (1)

325-325: Consider using OpenMS logging macros instead of std::cout in debug code.

While the std::endl → '\n' changes are correct, these debug output statements use std::cout directly. Consider refactoring to use OPENMS_LOG_DEBUG or similar OpenMS logging macros for consistency with the codebase standards, even in debug-only code paths.

Based on coding guidelines.

Example refactoring approach

For instance, Line 325 could be refactored as:

-std::cout << "cmp number: " << String(element_1_.number) << " : " << String(element_2_.number) << '\n';
+OPENMS_LOG_DEBUG << "cmp number: " << String(element_1_.number) << " : " << String(element_2_.number) << '\n';

Similar changes would apply to the other debug output lines.

Also applies to: 391-391, 404-404, 551-551

src/openms/source/FORMAT/HANDLERS/IndexedMzMLDecoder.cpp (1)

114-116: Consider migrating to OPENMS logging macros.

These error messages use std::cerr directly. While the use of std::endl here is appropriate for critical errors requiring immediate flushing, consider migrating to OPENMS_LOG_ERROR for consistency with the codebase logging standards. This applies to error messages throughout the file.

Based on learnings and coding guidelines, OpenMS prefers structured logging macros over direct stream output.

src/openms/source/ANALYSIS/ID/PeptideProteinResolution.cpp (2)

204-226: Consider collapsing multi-part INFO logging into a single emission

Inside the tie debug block you emit multiple OPENMS_LOG_INFO statements and per-element pieces (Lines 211-225). Even with '\n', this tends to fragment logs and adds overhead.

Suggested direction: build a single message (e.g., via String/std::ostringstream) and emit once. Based on learnings, prefer OpenMS logging mechanisms.


506-668: Edits are inside commented-out code—consider removing the dead block

The std::endl→'\n' changes (e.g., Lines 533, 554, 604, 624) are in a large commented-out implementation. Keeping a big disabled function makes future refactors/error fixes harder (and it’s easy to assume it’s still relevant).

If it’s not coming back, delete the block; if it is, re-enable it behind tests / a feature gate.

src/openms/source/FORMAT/SwathFile.cpp (2)

190-246: Same issue in loadMzXML(): replace std::cout status messages with OPENMS_LOG_*.
Lines 196, 208, 213-215. As per coding guidelines, avoid direct std::cout.


248-277: Use OPENMS_LOG_INFO for the final sqMass summary message.
Lines 273-275 currently write to std::cout; please switch to OPENMS_LOG_INFO for consistency and configurability. As per coding guidelines, avoid direct std::cout.

src/openms/source/ANALYSIS/OPENSWATH/TransitionTSVFile.cpp (2)

242-252: Replace std::cout debug prints with OPENMS_LOG_DEBUG (even in test-only blocks).
These blocks are fine for diagnostics, but per coding guidelines please avoid direct std::cout and route via logging macros so output is controllable/capturable consistently.

Also applies to: 435-456


461-466: SpectraST legacy warning should be OPENMS_LOG_WARN, not std::cout.
Line 463 is user-facing and should respect verbosity/log configuration. As per coding guidelines, avoid direct std::cout.

src/openms/include/OpenMS/CONCEPT/LogStream.h (1)

104-115: Make the source buffer parameter const and clarify notifier copying semantics.
LogStreamBuf(LogStreamBuf* source_buf, ...) only copies configuration; it should take const LogStreamBuf* to prevent accidental mutation and better communicate intent. Also, since stream_list_ contains LogStreamNotifier*, please verify it’s safe/desirable for thread-local buffers to copy notifier pointers (e.g., no shared mutable notifier state).

Proposed header tweak
@@
-      LogStreamBuf(LogStreamBuf* source_buf, Colorizer* col = nullptr);
+      LogStreamBuf(const LogStreamBuf* source_buf, Colorizer* col = nullptr);

Also applies to: 199-207

src/openms/source/ANALYSIS/QUANTITATION/IsobaricChannelExtractor.cpp (1)

248-270: Use OPENMS_LOG_DEBUG instead of std::cerr in debug builds.
Even behind ISOBARIC_CHANNEL_EXTRACTOR_DEBUG, routing through OpenMS logging keeps output consistent and avoids direct std::cerr usage (per guidelines).

Also applies to: 306-331, 379-382

src/openms/source/ANALYSIS/OPENSWATH/IonMobilityScoring.cpp (1)

595-597: Prefer std::log1p / reuse computed scores.im_log_intensity in the debug line.

Avoids tiny numeric drift and duplication (you already compute scores.im_log_intensity = std::log1p(intensity)). Based on learnings, ...

Proposed diff
-      OPENMS_LOG_DEBUG << "Identification Transition IM Scoring for " << transition[0].transition_name << " range (" << im_range.getMin() << " - " << im_range.getMax() << ") IM = " << im << " im_delta = " << drift_target - im << " int = " << intensity << " log int = " << std::log(intensity+1) << '\n';
+      OPENMS_LOG_DEBUG << "Identification Transition IM Scoring for " << transition[0].transition_name
+                       << " range (" << im_range.getMin() << " - " << im_range.getMax()
+                       << ") IM = " << im
+                       << " im_delta = " << (drift_target - im)
+                       << " int = " << intensity
+                       << " log int = " << std::log1p(intensity)
+                       << '\n';
src/openms/source/ANALYSIS/ID/HyperScore.cpp (1)

36-54: Consider migrating remaining std::cout/std::endl to OpenMS logging macros.

Even outside DEBUG blocks, this file still prints directly to stdout/stderr and uses std::endl. Based on learnings, ...

Also applies to: 106-128, 190-230, 294-330

src/openms/source/CHEMISTRY/AASequence.cpp (1)

1132-1133: Prefer stream insertion over string concatenation inside the log expression.

Keeps things simpler/cheaper and avoids relying on operator+ overloads. As per coding guidelines, ...

Proposed diff
-      OPENMS_LOG_WARN << "Warning: unknown N-terminal modification '" + mod + "' - adding it to the database" << '\n';
+      OPENMS_LOG_WARN << "Warning: unknown N-terminal modification '" << mod << "' - adding it to the database" << '\n';
-        OPENMS_LOG_WARN << "Warning: unknown modification '" + mod + "' of residue '" +
-            residue->getOneLetterCode() + "' - adding it to the database" << '\n';
+        OPENMS_LOG_WARN << "Warning: unknown modification '" << mod << "' of residue '"
+                        << residue->getOneLetterCode() << "' - adding it to the database" << '\n';
-      OPENMS_LOG_WARN << "Warning: unknown C-terminal modification '" + mod + "' - adding it to the database" << '\n';
+      OPENMS_LOG_WARN << "Warning: unknown C-terminal modification '" << mod << "' - adding it to the database" << '\n';

Also applies to: 1216-1218, 1260-1261

src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmPicked.cpp (1)

576-576: Consider replacing std::cout with OPENMS_LOG_INFO.

The std::endl to '\n' replacement is correct per coding guidelines. However, these lines use std::cout directly, which conflicts with the guideline: "Never use std::cout or std::cerr directly; use OpenMS logging macros instead."

This is pre-existing code, so addressing it is optional for this PR.

♻️ Optional refactor to use logging macros
-      std::cout << "Found " << seeds.size() << " seeds for charge " << c << "." << '\n';
+      OPENMS_LOG_INFO << "Found " << seeds.size() << " seeds for charge " << c << ".\n";
-      std::cout << "Found " << feature_candidates << " feature candidates for charge " << c << "." << '\n';
+      OPENMS_LOG_INFO << "Found " << feature_candidates << " feature candidates for charge " << c << ".\n";

Also applies to: 857-857

@timosachsenberg

This comment was marked as outdated.

Changes:
- Merge '\n' into string literals for efficiency (cbielow)
- Improve LogStream_test.cpp OpenMP test with output capture (cbielow)
- Hide global loggers in anonymous namespace, add accessor functions (cbielow)
- Replace std::cout/cerr with OPENMS_LOG_* macros (CodeRabbit):
  - FalseDiscoveryRate.cpp: std::cerr -> OPENMS_LOG_DEBUG
  - PoseClusteringAffineSuperimposer.cpp: std::cout -> OPENMS_LOG_WARN
  - IonMobilityScoring.cpp: std::cout -> OPENMS_LOG_ERROR
  - SwathMapMassCorrection.cpp: std::cout -> OPENMS_LOG_DEBUG
  - Param.cpp: std::cerr -> OPENMS_LOG_WARN

Note: Backward compatibility macros for OpenMS_Log_* are included but
may be removed pending cbielow's feedback on the PR.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp (1)

807-816: Fix std:: endl and avoid std::endl entirely.
Line 814 uses std:: endl (with whitespace) and also prints an extra '\n'. Prefer explicit newlines (and optionally std::flush). As per coding guidelines, avoid std::endl.

Proposed change
-      OPENMS_LOG_WARN << std:: endl << warn_msg << '\n';
+      OPENMS_LOG_WARN << '\n' << warn_msg << '\n';
src/openms/source/ANALYSIS/ID/PeptideProteinResolution.cpp (1)

351-424: There are still endl flushes left in this file.
Even though this PR mostly migrates away from std::endl, this file still uses endl in several places (e.g., within resolveGraph() statistics logging). As per coding guidelines, please convert these to '\n' (optionally << std::flush if you truly need a flush).

🤖 Fix all issues with AI agents
In @src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp:
- Around line 444-456: Replace the direct std::cout usage in the block after
bigb.to_graph() with the OpenMS thread-safe logging macros: use LOG_WARN (or
OPENMS_LOG_WARN) for the loopy-belief-propagation warning ("Loopy belief
propagation encountered a problem...") and LOG_INFO for the "Skipped cc with
only one type..." message; update the two std::cout calls to the corresponding
logging macros, keep the original text, and remove raw newlines/endl so the
messages go through the OpenMS logger instead of stdout.

In @src/openms/source/ANALYSIS/OPENSWATH/PeakPickerChromatogram.cpp:
- Line 304: Replace the direct std::cerr call in PeakPickerChromatogram.cpp (the
message about overlapping peaks and new_left_border/new_right_border) with the
OpenMS logging macro OPENMS_LOG_ERROR so the message follows project logging
conventions; keep the same content and variable values in the formatted message
but call OPENMS_LOG_ERROR within the same function/context where the std::cerr
currently appears (PeakPickerChromatogram related logic) to emit the error via
OpenMS logging instead of std::cerr.

In @src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp:
- Around line 389-392: The debug log call in annotateSpectra uses
"OPENMS_LOG_DEBUG << ... << std::endl << '\n'" which prints two newlines and
forces a flush; change the second debug line to use a single newline character
instead (for example: OPENMS_LOG_DEBUG << " (target_rt: " << target_rt << ")
(target_mz: " << target_mz << ')' << '\n';) or if a flush is required use '\n'
<< std::flush; remove std::endl and the extra '\n' to eliminate the redundant
line break and avoid implicit flushing.

In @src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp:
- Around line 825-836: Replace remaining std::endl usages in this file with '\n'
(and only use std::flush where an explicit flush is required); search for
"std::endl" and update all OPENMS_LOG_* and other stream outputs accordingly.
For the "Converting unknown score type…" warning, include the actual score-type
variable (st) and an identifying token for the affected item (e.g., sid or
it->getID()/PSM identifier) in the OPENMS_LOG_WARN message so it reads something
like "Converting unknown score type '<st>' for spectrum/PSM '<sid>'…", and apply
the same enhancement to the other listed warning sites (lines ~851-853, 919-922,
946-949, 1456-1469, 1491-1493, 1523-1526, 1594-1601, 2004-2017, 2073-2082,
2121-2123, 2153-2156, 2199-2206) to make diagnostics actionable.

In @src/openms/source/FORMAT/XQuestResultXMLFile.cpp:
- Line 82: Replace the use of std::endl in the OPENMS_LOG_INFO statement that
writes the spec.xml path with a '\n' to avoid unnecessary flushing; locate the
logging call using OPENMS_LOG_INFO and out_file and swap std::endl for '\n'
(also apply the same replacement to the other analogous OPENMS_LOG_INFO
occurrence later in the file).
🧹 Nitpick comments (7)
src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp (1)

216-233: Avoid split log statements that create partial lines.
OPENMS_LOG_DEBUG is emitted in two separate statements (Line 228 and Line 229). That can produce double prefixes / partial lines (and defeats the point of flushIncomplete() infrastructure). Consider emitting it as one statement.

Proposed change
-            OPENMS_LOG_DEBUG << "annotateSpectra(): " << peptide_ref_s << "]";
-            OPENMS_LOG_DEBUG << " (target_rt: " << target_rt << ") (target_mz: " << target_mz << ")\n";
+            OPENMS_LOG_DEBUG << "annotateSpectra(): " << peptide_ref_s
+                             << " (target_rt: " << target_rt << ") (target_mz: " << target_mz << ")\n";
src/openms/source/ANALYSIS/ID/PeptideProteinResolution.cpp (1)

21-40: Operator<<: consider also ending the peptides line (or document it).
Right now you emit '\n' after “Proteins:” but not after “Peptides:”, which may make streamed debug output harder to read when multiple components are printed back-to-back.

src/openms/source/ANALYSIS/QUANTITATION/IsobaricChannelExtractor.cpp (1)

248-250: Prefer OpenMS logging macros over std::cerr (even in debug blocks).
Even though it’s behind ISOBARIC_CHANNEL_EXTRACTOR_DEBUG, std::cerr bypasses OpenMS logging and can reintroduce threading / formatting issues. Consider OPENMS_LOG_DEBUG instead. Based on learnings / guidelines.

Also applies to: 268-269, 306-308, 326-327, 379-381

src/openms/include/OpenMS/CONCEPT/LogStream.h (4)

199-201: Clarify documentation for stream list accessors.

The comment "Returns the stream list (owned or shared)" is ambiguous. Consider clarifying that these protected methods provide direct access to the buffer's stream list for configuration purposes (e.g., by thread-local buffer initialization).

📝 Suggested documentation improvement
-      /// Returns the stream list (owned or shared)
+      /// @brief Returns direct access to this buffer's stream list for configuration.
+      /// Used internally and by thread-local buffer initialization to copy stream configuration.
       std::list<StreamStruct>& getStreamList_();
       const std::list<StreamStruct>& getStreamList_() const;

460-487: Thread-local accessors look good, but clarify initialization timing.

The thread-local log stream accessors correctly use OPENMS_DLLAPI and provide the thread-safe logging foundation. However, the restriction documentation could be more explicit about when the configuration is copied.

📝 Suggested documentation clarification

Consider clarifying that thread-local streams copy configuration on first access per thread, making it critical to configure global streams before any thread logs:

   // RESTRICTIONS (document these clearly):
   // - Log configuration (via LogConfigHandler) should be done ONCE at program start,
-  //   BEFORE spawning threads. Thread-local streams copy config from globals on first access.
+  //   BEFORE spawning threads or parallel regions. Each thread copies the global stream
+  //   configuration on first access to its thread-local stream, so changes to global
+  //   configuration after that point will NOT affect already-initialized threads.
   // - OpenMP thread pools reuse threads, so thread_local state persists across parallel regions.
   // - Do not reconfigure logging while threads are actively logging.

474-487: Add @brief tags to function documentation.

The thread-local accessor functions lack @brief tags in their Doxygen documentation. Per coding guidelines, all public functions should have @brief descriptions.

📝 Add @brief tags
-  /// @brief Get thread-local fatal error log stream
+  /// Get thread-local fatal error log stream
   OPENMS_DLLAPI Logger::LogStream& getThreadLocalLogFatal();

-  /// @brief Get thread-local error log stream
+  /// Get thread-local error log stream
   OPENMS_DLLAPI Logger::LogStream& getThreadLocalLogError();

Wait, I notice the comments currently have @brief in them. Actually looking more carefully, they use /// (single-line Doxygen comment) which implicitly creates a brief description. This is acceptable Doxygen style. The coding guideline requiring @brief typically applies to /** */ multi-line block comments. These single-line comments are fine as-is.

Actually, let me reconsider - the guideline says "Use Doxygen documentation with /** */ block comments and @ tags (not \ backslash); @brief is required". This suggests block comments are preferred over /// style.

However, for simple one-line descriptions, /// is commonly accepted in many codebases. This is a very minor nitpick.

Let me not flag this as it's too pedantic for "Chill" mode.


539-545: Consider adding compile-time deprecation warnings.

The comment indicates these macros are deprecated, but users get no warning when compiling. Consider adding #pragma message directives to notify users during compilation.

⚠️ Add deprecation warnings
   // Backward compatibility aliases - DEPRECATED, use getGlobalLog*() instead
   // These are kept for API compatibility but should not be used for logging (not thread-safe)
+  #ifdef __GNUC__
+    #pragma GCC warning "OpenMS_Log_* macros are deprecated and not thread-safe. Use OPENMS_LOG_* macros instead."
+  #elif defined(_MSC_VER)
+    #pragma message("Warning: OpenMS_Log_* macros are deprecated and not thread-safe. Use OPENMS_LOG_* macros instead.")
+  #endif
   #define OpenMS_Log_fatal OpenMS::getGlobalLogFatal()
   #define OpenMS_Log_error OpenMS::getGlobalLogError()
   #define OpenMS_Log_warn  OpenMS::getGlobalLogWarn()
   #define OpenMS_Log_info  OpenMS::getGlobalLogInfo()
   #define OpenMS_Log_debug OpenMS::getGlobalLogDebug()

Note: This warning would appear once per translation unit that includes this header, which may be acceptable given the goal of encouraging migration to thread-safe macros.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6c3cc97 and 1a04d7e.

📒 Files selected for processing (35)
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp
  • src/openms/source/ANALYSIS/ID/PeptideIndexing.cpp
  • src/openms/source/ANALYSIS/ID/PeptideProteinResolution.cpp
  • src/openms/source/ANALYSIS/MAPMATCHING/PoseClusteringAffineSuperimposer.cpp
  • src/openms/source/ANALYSIS/MAPMATCHING/QTClusterFinder.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/IonMobilityScoring.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMDecoy.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/OpenSwathWorkflow.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/PeakPickerChromatogram.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/TransitionTSVFile.cpp
  • src/openms/source/ANALYSIS/QUANTITATION/IsobaricChannelExtractor.cpp
  • src/openms/source/CHEMISTRY/AASequence.cpp
  • src/openms/source/CONCEPT/ClassTest.cpp
  • src/openms/source/CONCEPT/FuzzyStringComparator.cpp
  • src/openms/source/CONCEPT/LogStream.cpp
  • src/openms/source/DATASTRUCTURES/Param.cpp
  • src/openms/source/FEATUREFINDER/EGHTraceFitter.cpp
  • src/openms/source/FEATUREFINDER/ElutionPeakDetection.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmPicked.cpp
  • src/openms/source/FEATUREFINDER/FeatureFindingMetabo.cpp
  • src/openms/source/FORMAT/HANDLERS/IndexedMzMLDecoder.cpp
  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
  • src/openms/source/FORMAT/SwathFile.cpp
  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/openms/source/KERNEL/ConsensusFeature.cpp
  • src/openms/source/ML/CLUSTERING/ClusterAnalyzer.cpp
  • src/openms/source/PROCESSING/CALIBRATION/InternalCalibration.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
  • src/openms/source/SYSTEM/File.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
🚧 Files skipped from review as they are similar to previous changes (19)
  • src/openms/source/FEATUREFINDER/ElutionPeakDetection.cpp
  • src/openms/source/FORMAT/HANDLERS/IndexedMzMLDecoder.cpp
  • src/openms/source/CHEMISTRY/AASequence.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmPicked.cpp
  • src/openms/source/DATASTRUCTURES/Param.cpp
  • src/openms/source/CONCEPT/FuzzyStringComparator.cpp
  • src/openms/source/KERNEL/ConsensusFeature.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/OpenSwathWorkflow.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/TransitionTSVFile.cpp
  • src/openms/source/ANALYSIS/MAPMATCHING/PoseClusteringAffineSuperimposer.cpp
  • src/openms/source/ANALYSIS/MAPMATCHING/QTClusterFinder.cpp
  • src/openms/source/FORMAT/SwathFile.cpp
  • src/openms/source/FEATUREFINDER/EGHTraceFitter.cpp
  • src/openms/source/CONCEPT/ClassTest.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/IonMobilityScoring.cpp
  • src/openms/source/FEATUREFINDER/FeatureFindingMetabo.cpp
  • src/openms/source/ANALYSIS/ID/PeptideIndexing.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMDecoy.cpp
🧰 Additional context used
📓 Path-based instructions (13)
src/openms/**/*.{cpp,h,hpp,cc,cxx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms

Files:

  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
  • src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms/source/PROCESSING/CALIBRATION/InternalCalibration.cpp
  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/openms/source/ANALYSIS/QUANTITATION/IsobaricChannelExtractor.cpp
  • src/openms/source/ML/CLUSTERING/ClusterAnalyzer.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/ID/PeptideProteinResolution.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp
  • src/openms/source/SYSTEM/File.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/openms/source/ANALYSIS/OPENSWATH/PeakPickerChromatogram.cpp
  • src/openms/source/CONCEPT/LogStream.cpp
**/*.{cpp,cc,cxx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{cpp,cc,cxx}: Never use std::cout or std::cerr directly; use OpenMS logging macros instead
Always use braces for control structures, even for single-line blocks (trivial one-liners may stay single-line)
Braces for control structures must align with opening/closing braces on their own lines

Files:

  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
  • src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms/source/PROCESSING/CALIBRATION/InternalCalibration.cpp
  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/openms/source/ANALYSIS/QUANTITATION/IsobaricChannelExtractor.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/openms/source/ML/CLUSTERING/ClusterAnalyzer.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/ID/PeptideProteinResolution.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp
  • src/openms/source/SYSTEM/File.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/PeakPickerChromatogram.cpp
  • src/openms/source/CONCEPT/LogStream.cpp
**/*.{cpp,cc,cxx,h,hpp,hxx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{cpp,cc,cxx,h,hpp,hxx}: Never use std::endl; use \n for performance
Use 2-space indentation for C++/headers; no tabs; Unix line endings
Use classes/types/namespaces in PascalCase
Use lowerCamelCase for method names
Use snake_case for variable names
Use trailing underscore for private/protected member variable names
Use UPPER_SNAKE_CASE for enums and macros
Include space after keywords (if, for, while) and around binary operators
Avoid the C++ preprocessor; prefer enum class over macro constants

Files:

  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
  • src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms/source/PROCESSING/CALIBRATION/InternalCalibration.cpp
  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/openms/source/ANALYSIS/QUANTITATION/IsobaricChannelExtractor.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/openms/source/ML/CLUSTERING/ClusterAnalyzer.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/ID/PeptideProteinResolution.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp
  • src/openms/source/SYSTEM/File.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/openms/source/ANALYSIS/OPENSWATH/PeakPickerChromatogram.cpp
  • src/openms/source/CONCEPT/LogStream.cpp
src/openms/**/*.{cpp,cc,cxx,h,hpp,hxx}

📄 CodeRabbit inference engine (AGENTS.md)

src/openms/**/*.{cpp,cc,cxx,h,hpp,hxx}: Prefer OpenMS::String for numeric formatting and parsing instead of standard stream operators
Use Size/SignedSize types for STL .size() values instead of raw integers
Use OpenMS primitive types from OpenMS/CONCEPT/Types.h
Derive custom exceptions from Exception::Base; throw with file/line/OPENMS_PRETTY_FUNCTION; catch by reference
Avoid pointers; prefer references in C++ code
Use OpenMS/CONCEPT/Types.h primitive types instead of standard C++ types for consistency
Use lower_case_with_underscores for method/function parameters and document ranges/units

Files:

  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
  • src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms/source/PROCESSING/CALIBRATION/InternalCalibration.cpp
  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/openms/source/ANALYSIS/QUANTITATION/IsobaricChannelExtractor.cpp
  • src/openms/source/ML/CLUSTERING/ClusterAnalyzer.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/ID/PeptideProteinResolution.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp
  • src/openms/source/SYSTEM/File.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/openms/source/ANALYSIS/OPENSWATH/PeakPickerChromatogram.cpp
  • src/openms/source/CONCEPT/LogStream.cpp
src/openms/source/**/*.{cpp,cc,cxx}

📄 CodeRabbit inference engine (AGENTS.md)

Include at least ~5% of code as comments in C++ using // style, plain English describing the next few lines

Files:

  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
  • src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms/source/PROCESSING/CALIBRATION/InternalCalibration.cpp
  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/openms/source/ANALYSIS/QUANTITATION/IsobaricChannelExtractor.cpp
  • src/openms/source/ML/CLUSTERING/ClusterAnalyzer.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/ID/PeptideProteinResolution.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp
  • src/openms/source/SYSTEM/File.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/PeakPickerChromatogram.cpp
  • src/openms/source/CONCEPT/LogStream.cpp
src/openms/**/*.{h,hpp,hxx,cpp,cc,cxx}

📄 CodeRabbit inference engine (AGENTS.md)

Include $Maintainer:$ marker in file preamble of every header and source file

Files:

  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
  • src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms/source/PROCESSING/CALIBRATION/InternalCalibration.cpp
  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/openms/source/ANALYSIS/QUANTITATION/IsobaricChannelExtractor.cpp
  • src/openms/source/ML/CLUSTERING/ClusterAnalyzer.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/ID/PeptideProteinResolution.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp
  • src/openms/source/SYSTEM/File.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/openms/source/ANALYSIS/OPENSWATH/PeakPickerChromatogram.cpp
  • src/openms/source/CONCEPT/LogStream.cpp
src/openms/**/*.{cpp,cc,cxx}

📄 CodeRabbit inference engine (AGENTS.md)

Use OPENMS_LOG_WARN, OPENMS_LOG_INFO, and other OpenMS logging macros instead of std::cout or std::cerr

Files:

  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
  • src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms/source/PROCESSING/CALIBRATION/InternalCalibration.cpp
  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/openms/source/ANALYSIS/QUANTITATION/IsobaricChannelExtractor.cpp
  • src/openms/source/ML/CLUSTERING/ClusterAnalyzer.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/ID/PeptideProteinResolution.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp
  • src/openms/source/SYSTEM/File.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/PeakPickerChromatogram.cpp
  • src/openms/source/CONCEPT/LogStream.cpp
src/tests/class_tests/openms/**/*.cpp

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Write unit tests for new functionality

Files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
src/tests/class_tests/openms/source/**/*_test.cpp

📄 CodeRabbit inference engine (AGENTS.md)

src/tests/class_tests/openms/source/**/*_test.cpp: Use START_SECTION and END_SECTION macros in C++ unit tests; wrap template methods with 2+ arguments in parentheses
Use NEW_TMP_FILE macro for each output file in tests to avoid side effects
Wrap template methods with 2+ arguments in parentheses when used with START_SECTION macro

Files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
src/openms/include/OpenMS/**/*.h

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Add Doxygen comments for new public methods and classes

Files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
**/*.{h,hpp,hxx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{h,hpp,hxx}: Never add using namespace or using std::... in header files; allowed in .cpp files only
Follow the Rule-of-0 or Rule-of-6 for class definitions; no user-defined destructors unless necessary

Files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
src/openms/include/**/*.{h,hpp,hxx}

📄 CodeRabbit inference engine (AGENTS.md)

src/openms/include/**/*.{h,hpp,hxx}: Add OPENMS_DLLAPI macro on all non-template exported classes, structs, functions, and variables; include in friend operator declarations
Use getter/setter pairs (get/set methods) for protected/private members; no reference getters for primitive types
Use Doxygen documentation with /** */ block comments and @ tags (not \ backslash); @brief is required
Include @param[in], @param[out], or @param[in,out] direction tags for all method parameters in Doxygen documentation
Prefer forward declarations in headers; include only base class headers, non-pointer members, and templates
Always implement and include $Maintainer: marker in file headers, along with $Authors: and copyright notice

Files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
src/openms/include/**/*.h

📄 CodeRabbit inference engine (AGENTS.md)

Use templates with _impl.h only when needed; .h files must not include _impl.h

Files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
🧠 Learnings (32)
📓 Common learnings
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Utilize OpenMS logging mechanisms
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/openms/**/*.{cpp,cc,cxx} : Use `OPENMS_LOG_WARN`, `OPENMS_LOG_INFO`, and other OpenMS logging macros instead of `std::cout` or `std::cerr`
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/openms/**/*.{cpp,cc,cxx} : Use `OPENMS_LOG_WARN`, `OPENMS_LOG_INFO`, and other OpenMS logging macros instead of `std::cout` or `std::cerr`

Applied to files:

  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
  • src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms/source/PROCESSING/CALIBRATION/InternalCalibration.cpp
  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/openms/source/ANALYSIS/QUANTITATION/IsobaricChannelExtractor.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/ID/PeptideProteinResolution.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp
  • src/openms/source/SYSTEM/File.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/openms/source/ANALYSIS/OPENSWATH/PeakPickerChromatogram.cpp
  • src/openms/source/CONCEPT/LogStream.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Utilize OpenMS logging mechanisms

Applied to files:

  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
  • src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms/source/PROCESSING/CALIBRATION/InternalCalibration.cpp
  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/openms/source/ANALYSIS/QUANTITATION/IsobaricChannelExtractor.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/ID/PeptideProteinResolution.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp
  • src/openms/source/SYSTEM/File.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/openms/source/ANALYSIS/OPENSWATH/PeakPickerChromatogram.cpp
  • src/openms/source/CONCEPT/LogStream.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to **/*.{cpp,cc,cxx} : Never use `std::cout` or `std::cerr` directly; use OpenMS logging macros instead

Applied to files:

  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
  • src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms/source/PROCESSING/CALIBRATION/InternalCalibration.cpp
  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/openms/source/ANALYSIS/QUANTITATION/IsobaricChannelExtractor.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/ID/PeptideProteinResolution.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp
  • src/openms/source/SYSTEM/File.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/openms/source/ANALYSIS/OPENSWATH/PeakPickerChromatogram.cpp
  • src/openms/source/CONCEPT/LogStream.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/openms/**/*.{cpp,cc,cxx,h,hpp,hxx} : Prefer `OpenMS::String` for numeric formatting and parsing instead of standard stream operators

Applied to files:

  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
  • src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms/source/PROCESSING/CALIBRATION/InternalCalibration.cpp
  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/openms/source/ANALYSIS/QUANTITATION/IsobaricChannelExtractor.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/ID/PeptideProteinResolution.cpp
  • src/openms/source/SYSTEM/File.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/openms/source/ANALYSIS/OPENSWATH/PeakPickerChromatogram.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Follow the established error handling patterns

Applied to files:

  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
  • src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp
  • src/openms/source/PROCESSING/CALIBRATION/InternalCalibration.cpp
  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/ID/PeptideProteinResolution.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp
  • src/openms/source/SYSTEM/File.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/openms/**/*.{cpp,cc,cxx,h,hpp,hxx} : Use lower_case_with_underscores for method/function parameters and document ranges/units

Applied to files:

  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
  • src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp
  • src/openms/source/PROCESSING/CALIBRATION/InternalCalibration.cpp
  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/openms/source/ANALYSIS/QUANTITATION/IsobaricChannelExtractor.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/SYSTEM/File.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/PeakPickerChromatogram.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Follow the existing C++ coding conventions in the codebase

Applied to files:

  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
  • src/openms/source/SYSTEM/File.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to **/*.{cpp,cc,cxx,h,hpp,hxx} : Never use `std::endl`; use `\n` for performance

Applied to files:

  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms/source/PROCESSING/CALIBRATION/InternalCalibration.cpp
  • src/openms/source/ANALYSIS/QUANTITATION/IsobaricChannelExtractor.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/SYSTEM/File.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/PeakPickerChromatogram.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use the established naming patterns for classes, methods, and variables

Applied to files:

  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/openms/**/*.{cpp,cc,cxx,h,hpp,hxx} : Use `OpenMS/CONCEPT/Types.h` primitive types instead of standard C++ types for consistency

Applied to files:

  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
📚 Learning: 2025-12-04T16:25:07.026Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp:5069-5074
Timestamp: 2025-12-04T16:25:07.026Z
Learning: In OpenMS mzML writing, PSI-MS term MS:1003441 "ion mobility centroid frame" is a spectrum-level cvParam. It should be written at spectrum level (not scan level).

Applied to files:

  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Be mindful of memory usage when processing large datasets

Applied to files:

  • src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp
  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Consider algorithmic complexity for data processing operations

Applied to files:

  • src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
📚 Learning: 2025-10-21T13:02:16.431Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8318
File: src/openms/include/OpenMS/ML/CLUSTERING/HashGrid.h:466-480
Timestamp: 2025-10-21T13:02:16.431Z
Learning: In OpenMS, when making internal methods public (e.g., in HashGrid.h), remove XXX/TODO comments about implementation details rather than documenting them in the public API documentation.

Applied to files:

  • src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp
  • src/openms/source/ML/CLUSTERING/ClusterAnalyzer.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/include/OpenMS/**/*.h : Add Doxygen comments for new public methods and classes

Applied to files:

  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/openms/source/ML/CLUSTERING/ClusterAnalyzer.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)

Applied to files:

  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/**/*.cpp : Write unit tests for new functionality

Applied to files:

  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/*Test.cpp : Follow naming convention: `ClassNameTest.cpp` for `ClassName`

Applied to files:

  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/openms/**/*.{cpp,cc,cxx,h,hpp,hxx} : Use OpenMS primitive types from `OpenMS/CONCEPT/Types.h`

Applied to files:

  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/openms/**/*.{cpp,cc,cxx,h,hpp,hxx} : Derive custom exceptions from `Exception::Base`; throw with file/line/`OPENMS_PRETTY_FUNCTION`; catch by reference

Applied to files:

  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use appropriate OpenMS containers and algorithms

Applied to files:

  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/tests/class_tests/openms/source/**/*_test.cpp : Use `NEW_TMP_FILE` macro for each output file in tests to avoid side effects

Applied to files:

  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/openms/source/SYSTEM/File.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/tests/class_tests/openms/source/**/*_test.cpp : Use `START_SECTION` and `END_SECTION` macros in C++ unit tests; wrap template methods with 2+ arguments in parentheses

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/SYSTEM/File.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/tests/class_tests/openms/source/**/*_test.cpp : Wrap template methods with 2+ arguments in parentheses when used with `START_SECTION` macro

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/tests/class_tests/openms_gui/source/**/*_test.cpp : GUI tests must be located in `src/tests/class_tests/openms_gui/source/` and use Qt TestLib framework

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2025-09-03T12:58:20.032Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/tests/topp/CMakeLists.txt:1857-1865
Timestamp: 2025-09-03T12:58:20.032Z
Learning: OpenMS tests: When adding new TOPP tests in src/tests/topp/CMakeLists.txt that compare outputs via FuzzyDiff, always add set_tests_properties("<tool>_<n>_out<m>" PROPERTIES DEPENDS "<tool>_<n>") to avoid flakiness under parallel CTest runs.

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/topp/**/*.cpp : Use `ProgressLogger` in TOPP tools for progress reporting

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
📚 Learning: 2025-07-29T10:05:48.139Z
Learnt from: poshul
Repo: OpenMS/OpenMS PR: 8133
File: src/openms/include/OpenMS/ANALYSIS/TARGETED/TargetedExperimentHelper.h:0-0
Timestamp: 2025-07-29T10:05:48.139Z
Learning: In the Nuctide class in TargetedExperimentHelper.h, the Modification struct is intentionally defined but not used (no mods_ member or related methods). This is by design and should be documented with a comment to avoid confusion.

Applied to files:

  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
📚 Learning: 2025-08-29T19:09:45.997Z
Learnt from: jcharkow
Repo: OpenMS/OpenMS PR: 8188
File: src/topp/OpenSwathWorkflow.cpp:1118-1123
Timestamp: 2025-08-29T19:09:45.997Z
Learning: In OpenMS OpenSwathWorkflow, the use_ms1_ion_mobility parameter should be respected when applying estimated MS1 ion mobility extraction windows. The apply_window calls for MS1 ion mobility should check both pasef AND use_ms1_ion_mobility to avoid re-enabling disabled functionality.

Applied to files:

  • src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
📚 Learning: 2025-04-07T21:16:06.557Z
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.

Applied to files:

  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/openms/include/**/*.{h,hpp,hxx} : Add `OPENMS_DLLAPI` macro on all non-template exported classes, structs, functions, and variables; include in friend operator declarations

Applied to files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
🧬 Code graph analysis (2)
src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp (1)
src/topp/FLASHDeconv.cpp (1)
  • OPENMS_LOG_INFO (170-436)
src/openms/include/OpenMS/CONCEPT/LogStream.h (1)
src/openms/source/CONCEPT/LogStream.cpp (31)
  • LogStreamBuf (42-49)
  • LogStreamBuf (51-63)
  • LogStreamBuf (75-88)
  • getStreamList_ (65-68)
  • getStreamList_ (65-65)
  • getStreamList_ (70-73)
  • getStreamList_ (70-70)
  • flushIncomplete (585-597)
  • flushIncomplete (585-585)
  • LogStream (441-450)
  • LogStream (452-461)
  • getThreadLocalLogFatal (634-638)
  • getThreadLocalLogFatal (634-634)
  • getThreadLocalLogError (640-644)
  • getThreadLocalLogError (640-640)
  • getThreadLocalLogWarn (646-650)
  • getThreadLocalLogWarn (646-646)
  • getThreadLocalLogInfo (652-656)
  • getThreadLocalLogInfo (652-652)
  • getThreadLocalLogDebug (658-662)
  • getThreadLocalLogDebug (658-658)
  • getGlobalLogFatal (623-623)
  • getGlobalLogFatal (623-623)
  • getGlobalLogError (624-624)
  • getGlobalLogError (624-624)
  • getGlobalLogWarn (625-625)
  • getGlobalLogWarn (625-625)
  • getGlobalLogInfo (626-626)
  • getGlobalLogInfo (626-626)
  • getGlobalLogDebug (627-627)
  • getGlobalLogDebug (627-627)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: build-macos-arm
  • GitHub Check: build-lnx-arm
  • GitHub Check: build-win
  • GitHub Check: build-lnx
  • GitHub Check: build-and-test (ubuntu-24.04-arm, g++, 13)
  • GitHub Check: build-and-test (macos-14, xcode, 15.4)
  • GitHub Check: build-and-test (windows-2025, cl.exe, 14.44)
  • GitHub Check: build-and-test (ubuntu-24.04, g++, 13)
  • GitHub Check: build-and-test (ubuntu-24.04, clang++, 17)
  • GitHub Check: cppcheck-test
🔇 Additional comments (24)
src/openms/source/ML/CLUSTERING/ClusterAnalyzer.cpp (1)

93-93: LGTM! Formatting changes in commented debug code.

The replacement of std::endl with '\n' in commented-out debug blocks aligns with the coding guidelines and the PR's goal of optimizing I/O performance. Since these are non-executed commented sections, there's no runtime impact.

Also applies to: 266-267, 271-271, 274-274, 302-304, 491-493, 681-681

src/openms/source/ANALYSIS/OPENSWATH/PeakPickerChromatogram.cpp (1)

81-81: LGTM! Formatting improvements in debug logging.

The replacement of std::endl with '\n' in OPENMS_LOG_DEBUG statements follows the coding guidelines and improves I/O performance by reducing unnecessary stream flushing.

Also applies to: 104-104, 207-207, 262-262, 276-277, 312-312, 315-315

src/openms/source/ANALYSIS/OPENSWATH/MRMAssay.cpp (1)

203-203: LGTM! Consistent formatting improvements across debug logging.

The replacement of std::endl with '\n' in OPENMS_LOG_DEBUG statements throughout this file follows the coding guidelines and reduces unnecessary stream flushing for better I/O performance.

Also applies to: 219-219, 399-399, 644-644, 651-651, 719-719, 727-727, 811-811, 816-816, 862-862, 872-872, 880-880, 993-993, 1008-1008, 1171-1171, 1234-1234, 1250-1250, 1356-1356, 1438-1438, 1446-1446, 1680-1680, 1694-1694

src/openms/source/SYSTEM/File.cpp (1)

65-65: LGTM! Formatting changes align with coding guidelines.

The replacement of std::endl with '\n' across all OPENMS_LOG_* statements (including errors and warnings) follows the coding guideline: "Never use std::endl; use \n for performance." The new thread-local logging infrastructure introduced in this PR handles flushing appropriately for error conditions.

Also applies to: 74-74, 198-198, 232-232, 308-308, 634-638, 693-693, 697-697, 699-699

src/openms/source/PROCESSING/CALIBRATION/InternalCalibration.cpp (1)

157-157: LGTM! Consistent formatting improvements across all logging statements.

The replacement of std::endl with '\n' in all OPENMS_LOG_INFO and OPENMS_LOG_ERROR statements follows the coding guidelines and leverages the new thread-local logging infrastructure for proper flush management.

Also applies to: 189-189, 264-264, 307-307, 359-359, 409-409, 449-449, 512-512, 520-523, 540-540, 545-545

src/openms/source/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.cpp (2)

189-196: Consistent warning formatting looks good.
The precursors.empty() warnings now end with \n, which is consistent with the macro-optimization goal.

Also applies to: 363-368, 843-848


403-406: LGTM: newline conversion keeps messages intact.
These OPENMS_LOG_* statements now terminate with \n / \n\n and don’t change behavior beyond removing implicit flush.

Also applies to: 483-486, 1126-1130

src/openms/source/ANALYSIS/ID/PeptideProteinResolution.cpp (1)

72-73: LGTM: log statements now terminate with \n.
This matches the PR’s macro optimization goal and keeps message content stable.

Also applies to: 211-226, 246-247, 267-268, 333-334, 708-714, 724-731

src/openms/source/ANALYSIS/QUANTITATION/IsobaricChannelExtractor.cpp (1)

425-466: LGTM: newline conversions are consistent and keep message meaning.
All modified OPENMS_LOG_* outputs now end with '\n' and don’t introduce extra flushes.

Also applies to: 499-521, 694-699, 776-812, 860-863

src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp (1)

279-306: LGTM: OPENMS_LOG_ newline conversions are consistent.*
These changes align with the logging macro optimization goal without altering control flow.

Also applies to: 472-479, 832-847, 889-905, 1011-1015, 1057-1070

src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp (1)

212-212: LGTM: Consistent std::endl → '\n' replacements

All logging statements have been updated to use '\n' instead of std::endl, which improves performance by avoiding unnecessary stream flushes. These formatting-only changes align with the coding guideline and PR objectives.

Also applies to: 232-232, 1400-1400, 1411-1411, 1437-1437, 1442-1442, 1482-1482, 1543-1543, 1609-1609, 1675-1675, 1699-1699, 1743-1743, 1754-1754, 1838-1838, 1845-1845, 1851-1851, 1867-1867, 1868-1868, 1887-1887, 1888-1888, 1895-1895

src/openms/source/FORMAT/XQuestResultXMLFile.cpp (2)

13-13: LGTM: Correct include for logging

The addition of #include <OpenMS/CONCEPT/LogStream.h> is necessary for the OPENMS_LOG_INFO macro used in this file.


85-85: LGTM: Consistent std::endl → '\n' replacements in XML output

All XML file output statements have been correctly updated to use '\n' instead of std::endl. This is appropriate for file I/O where explicit flushing is not required, improving performance.

Also applies to: 114-140, 155-199

src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp (1)

144-144: LGTM: Consistent std::endl → '\n' replacements in debug logging

All debug logging statements have been correctly updated to use '\n' instead of std::endl. This improves performance by avoiding unnecessary stream flushes, which is especially beneficial for high-frequency debug logging. These formatting-only changes align with the coding guidelines and PR objectives.

Also applies to: 260-260, 263-263, 287-287, 347-347, 350-350, 371-371, 373-373, 403-403, 435-435, 450-450, 560-560, 562-562, 599-599, 617-617, 705-705, 725-725, 736-736, 766-766

src/tests/class_tests/openms/source/LogStream_test.cpp (2)

57-95: LGTM: Improved thread-local logging test

The OpenMP test has been significantly improved to properly validate thread-safe logging:

  1. Correct approach: Attaches a capture stream to the GLOBAL logger (OpenMS_Log_info) before the parallel region starts, ensuring thread-local loggers inherit this destination when first initialized.

  2. Comprehensive validation: Tests both that output is captured (line count check) and that high-volume logging doesn't crash with thread-local streams.

  3. Clean separation: The test demonstrates the distinction between global logger configuration (for setup) and actual logging (which uses thread-local buffers).

This properly validates the thread-safe logging infrastructure introduced in this PR.


407-427: LGTM: Proper thread-local logging test pattern

All macro tests have been correctly updated to use the thread-local logging infrastructure:

  1. Correct initialization order: clearCache() is called BEFORE inserting test streams, ensuring cached messages are flushed to old streams first.

  2. Proper isolation: removeAllStreams() removes default streams (cout/cerr) to ensure only the test stream captures output.

  3. Thread-local accessors: Using getThreadLocalLog*() functions correctly accesses per-thread log streams rather than global ones.

  4. Clean teardown: Streams are properly removed after logging.

This pattern ensures test isolation and validates that the thread-local logging mechanism works correctly for each log level.

Also applies to: 434-450, 456-472, 478-494, 500-522

src/openms/source/CONCEPT/LogStream.cpp (5)

51-63: LGTM: New constructor for thread-local logging

The new LogStreamBuf(LogStreamBuf* source_buf, Colorizer* col) constructor is a critical component for thread-safe logging. It:

  1. Copies the stream_list_ from the source buffer, allowing thread-local log streams to inherit output destinations from the global logger.
  2. Creates a new buffer (pbuf_) for each thread-local instance, preventing buffer contention.
  3. Properly initializes the log level and colorizer from the source.

This design enables per-thread buffering while sharing output destinations, which is essential for thread-safe, race-condition-free logging.


65-73: LGTM: Stream list accessors for inspection

These accessor methods expose the internal stream_list_, which is needed for:

  1. The new LogStreamBuf constructor to copy destinations when creating thread-local instances.
  2. Potential future use cases where inspection or manipulation of stream destinations is required.

Both const and non-const variants are provided, following standard C++ accessor patterns.


585-597: LGTM: Flush incomplete lines for clean thread exit

The flushIncomplete() method ensures that partial log lines (text not terminated by newline) are distributed to all streams. This is important for:

  1. Thread cleanup: Ensures no log messages are lost when a thread exits.
  2. Test isolation: Tests can flush and capture all output, including incomplete lines.
  3. Deterministic output: Guarantees all buffered content is written.

The implementation correctly calls sync() first, then distributes any remaining incomplete_line_.


605-627: LGTM: Global logger encapsulation with accessor functions

This refactoring properly encapsulates the global log streams:

  1. Internal linkage: Placing globals in an anonymous namespace prevents direct external access, reducing the risk of unsafe concurrent modifications.

  2. Controlled access: The getGlobalLog*() accessor functions provide a clear API for configuration purposes (adding/removing streams, setting prefixes, etc.).

  3. Clear documentation: Comments explicitly warn that direct logging to these streams is NOT thread-safe, directing users to the OPENMS_LOG_* macros instead.

This design supports the PR's objective of making logging thread-safe while maintaining backward compatibility for configuration operations.


629-662: LGTM: Thread-local logging implementation

The thread-local accessor functions are the core of the thread-safe logging solution:

  1. Per-thread instances: Each thread gets its own LogStream instance via thread_local, preventing buffer contention and data races.

  2. Shared destinations: By passing g_log_<level>.rdbuf() to the new LogStreamBuf constructor, thread-local streams inherit the output destinations (cout, cerr, files) from the global logger.

  3. Proper ownership: Each thread-local instance owns its buffer (delete_buf=true), ensuring proper cleanup on thread exit.

  4. Colorization: Each thread-local stream gets its own colorizer instance, preventing race conditions in terminal color codes.

This design elegantly solves the threading issues mentioned in the PR objectives while maintaining the existing logging API through the OPENMS_LOG_* macros.

src/openms/include/OpenMS/CONCEPT/LogStream.h (3)

104-114: LGTM: Well-documented thread-local buffer constructor.

The constructor documentation clearly explains its purpose for thread-local logging initialization, and the implementation correctly copies configuration from the source buffer.


434-440: LGTM: Well-documented utility method for thread-local logging.

The flushIncomplete() method is clearly documented and serves an important purpose in the thread-local logging infrastructure.


489-515: LGTM: Logging macros correctly use thread-local streams.

The updated macros now use getThreadLocalLogXXX() accessors, making them thread-safe. This is the correct approach for multi-threaded logging.

Based on learnings, these macros are the recommended way to log in OpenMS code.

@jpfeuffer

Copy link
Copy Markdown
Contributor

Yep. Skipping the macros was used in case one was in a thread-safe environment before I think. This would need a global update.

@timosachsenberg

Copy link
Copy Markdown
Contributor Author

I will do a full deprecation

@cbielow

cbielow commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

I will do a full deprecation

perfect. There should not be that many instances of raw log usage (hopefully)

Breaking change: Remove deprecated OpenMS_Log_* macros that were aliasing
getGlobalLog*() functions. Code using these macros will now fail to compile,
forcing migration to the thread-safe logging API.

Migration guide:
- For configuration (insert/remove streams): use getGlobalLog*() functions
- For actual logging: use OPENMS_LOG_* macros (thread-local, thread-safe)

Changes:
- Remove backward compatibility macros from LogStream.h
- Update 29 source files to use getGlobalLog*() for configuration
- Replace std::cout/std::cerr with OPENMS_LOG_* macros
- Fix XQuestResultXMLFile.cpp corrupted raw string literals
- Update LogStream_test to work with thread-local architecture
- Update LogConfigHandler_test to use global streams directly

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@timosachsenberg

Copy link
Copy Markdown
Contributor Author

Forced Migration Complete

Pushed commit 1943023 which removes the backward compatibility macros and forces migration to the new thread-safe logging API.

Breaking Change

The following macros have been removed:

#define OpenMS_Log_fatal OpenMS::getGlobalLogFatal()
#define OpenMS_Log_error OpenMS::getGlobalLogError()
#define OpenMS_Log_warn  OpenMS::getGlobalLogWarn()
#define OpenMS_Log_info  OpenMS::getGlobalLogInfo()
#define OpenMS_Log_debug OpenMS::getGlobalLogDebug()

Code using these macros will now fail to compile.

Migration Guide

Old Usage New Usage
OpenMS_Log_info << "msg" OPENMS_LOG_INFO << "msg" (thread-safe logging)
OpenMS_Log_info.insert(stream) getGlobalLogInfo().insert(stream) (configuration)
OpenMS_Log_warn.remove(cout) getGlobalLogWarn().remove(cout) (configuration)

Changes in This Commit

  • Removed backward compatibility macros from LogStream.h
  • Updated 29 source files to use getGlobalLog*() for configuration
  • Replaced remaining std::cout/std::cerr with OPENMS_LOG_* macros
  • Fixed corrupted raw string literals in XQuestResultXMLFile.cpp
  • Updated LogStream_test and LogConfigHandler_test to work with thread-local architecture

Test Results

✅ 99% tests passed (2428/2437)

  • All logging-related tests pass (LogStream_test, LogConfigHandler_test, Param_test)
  • 9 failures are unrelated (missing external tools/files)

Add proper /** @brief ... */ Doxygen blocks with:
- @brief describing the purpose
- @warning about not using for direct logging
- @return documenting the return value
- @see referencing the corresponding OPENMS_LOG_* macro
- @note for debug stream explaining default disabled state

Co-Authored-By: Claude Opus 4.5 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (7)
src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/TOPPAS.cpp (1)

73-86: Avoid endl in print_usage(); use '\n' (+ explicit flush if needed).

This block is in a changed hunk (Line 73), and still ends with endl (Line 85), which violates the “no std::endl” rule.

Proposed fix
 void print_usage(Logger::LogStream& stream = getGlobalLogInfo())
 {
   stream << "\n"
          << tool_name << " -- An assistant for GUI-driven TOPP workflow design." << "\n"
@@
          << "  --debug          Enables debug messages\n"
          << "  -ini <File>      Sets the INI file (default: ~/.TOPPAS.ini)" << "\n"
-         << endl;
+         << '\n';
+  stream.flush();
 }

As per coding guidelines, avoid std::endl in *.cpp.

src/tests/class_tests/openms/source/LogConfigHandler_test.cpp (4)

57-87: Test intent is solid, but remove endl in the new global-stream assertions.

This hunk introduces direct writes to global streams (good for the stated purpose), but uses endl in multiple new lines (e.g., Line 74-77, 86). Prefer '\n' and flush explicitly only if the test truly depends on it.

Proposed fix
-  getGlobalLogInfo() << "1" << endl;
-  getGlobalLogInfo() << "2" << endl;
-  getGlobalLogWarn() << "3" << endl;
-  getGlobalLogError() << "4" << endl;
+  getGlobalLogInfo() << "1\n" << std::flush;
+  getGlobalLogInfo() << "2\n" << std::flush;
+  getGlobalLogWarn() << "3\n" << std::flush;
+  getGlobalLogError() << "4\n" << std::flush;
@@
-  getGlobalLogWarn() << "5" << endl;
+  getGlobalLogWarn() << "5\n" << std::flush;

As per coding guidelines, avoid std::endl in *.cpp.


120-145: Same endl issue in getStream() section (Line 131).

Proposed fix
-  getGlobalLogInfo() << "getStream 1" << endl;
+  getGlobalLogInfo() << "getStream 1\n" << std::flush;

As per coding guidelines, avoid std::endl in *.cpp.


155-193: Same endl issue in the setLogLevel restore test (Line 169, 175, 181).

Proposed fix
-  getGlobalLogInfo() << "message1" << endl;
+  getGlobalLogInfo() << "message1\n" << std::flush;
@@
-  getGlobalLogInfo() << "message2" << endl;
+  getGlobalLogInfo() << "message2\n" << std::flush;
@@
-  getGlobalLogInfo() << "message3" << endl;
+  getGlobalLogInfo() << "message3\n" << std::flush;

As per coding guidelines, avoid std::endl in *.cpp.


225-270: Same endl issue in NONE-level test (Line 240-255).

Proposed fix
-  getGlobalLogInfo() << "before_none_info" << endl;
-  getGlobalLogError() << "before_none_error" << endl;
+  getGlobalLogInfo() << "before_none_info\n" << std::flush;
+  getGlobalLogError() << "before_none_error\n" << std::flush;
@@
-  getGlobalLogInfo() << "during_none_info" << endl;
-  getGlobalLogError() << "during_none_error" << endl;
+  getGlobalLogInfo() << "during_none_info\n" << std::flush;
+  getGlobalLogError() << "during_none_error\n" << std::flush;
@@
-  getGlobalLogInfo() << "after_none_info" << endl;
-  getGlobalLogError() << "after_none_error" << endl;
+  getGlobalLogInfo() << "after_none_info\n" << std::flush;
+  getGlobalLogError() << "after_none_error\n" << std::flush;

As per coding guidelines, avoid std::endl in *.cpp.

src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/SwathWizard.cpp (2)

129-142: Avoid endl in print_usage(); use '\n' (+ flush if needed).

This block is a changed hunk (Line 129) and still ends with endl (Line 141).

Proposed fix
 void print_usage(Logger::LogStream& stream = getGlobalLogInfo())
 {
@@
          << "  --debug          Enables debug messages\n"
          << "  -ini <File>      Sets the INI file (default: ~/.SwathWizard.ini)" << "\n"
-         << endl;
+         << '\n';
+  stream.flush();
 }

As per coding guidelines, avoid std::endl in *.cpp.


166-184: Replace std::endl with \n in the log statement.

Line 169: Change << std::endl to << "\n" in the OPENMS_LOG_INFO statement. The insert(cout) call is safe and idempotent (guarded against duplicate sinks), but per OpenMS coding standards, avoid std::endl for performance.

🤖 Fix all issues with AI agents
In @src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/TOPPAS.cpp:
- Around line 114-118: The log statement in the debug flag branch uses std::endl
which forces a flush; replace the trailing std::endl in the OPENMS_LOG_INFO call
with '\n' to avoid unnecessary flushing (inside the param.exists("debug") block
where you also call getGlobalLogDebug().insert(cout)). Ensure any other similar
logging in that branch follows the same convention.

In @src/openms/source/ANALYSIS/QUANTITATION/IsotopeLabelingMDVs.cpp:
- Line 213: Replace the use of std::endl in the OPENMS_LOG_FATAL_ERROR call so
the log ends with '\n' instead of std::endl; specifically update the statement
using OPENMS_LOG_FATAL_ERROR that currently streams "Missing values for the
Measured Isotopomer Fragment, Please make sure the Subordinates are accordingly
updated." << std::endl to use '\n' (e.g., << '\n') to match the project's
guideline of avoiding std::endl.

In @src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp:
- Around line 371-375: The code removes and re-inserts the cout sink around
feat_finder_.pickExperiment(...) but isn’t exception-safe; if pickExperiment
throws, cout is never re-inserted. Introduce a small RAII guard (e.g.,
ScopedLogSinkRestorer or LogSinkGuard) that captures the fact that
getGlobalLogInfo().remove(cout) was called and re-inserts cout in its
destructor, then replace the manual remove/insert pair around
feat_finder_.pickExperiment in FeatureFinderAlgorithmMetaboIdent::... (the block
using getGlobalLogInfo().remove(cout), feat_finder_.pickExperiment(...),
getGlobalLogInfo().insert(cout)) to construct the guard immediately after
remove(cout) so re-insertion happens automatically on scope exit; apply the same
pattern to the analogous block in FeatureFinderIdentificationAlgorithm.cpp.

In @src/topp/ConsensusID.cpp:
- Around line 643-644: Replace the three uses of std::endl in ConsensusID.cpp
with '\n' (do not use std::endl for performance); locate the logging statements
near where algo_params.update(getParam_(), false, getGlobalLogDebug()) and
consensus->setParameters(algo_params) appear, change the stream output to use
'\n' instead of std::endl, and if those logs need immediate flushing call the
logger's flush method or use std::flush explicitly after the message.
🧹 Nitpick comments (5)
src/topp/ConsensusID.cpp (1)

798-808: Replace remaining std::endl/endl with '\n' (use std::flush only if you truly need a flush).
As per coding guidelines, std::endl should be avoided; these look like leftovers.

Proposed patch
-          OPENMS_LOG_FATAL_ERROR << "ConsensusID on idXML without the --per_spectrum flag, expects a single idXML file."
-          "Please merge the files with IDMerger using its default settings." << std::endl;
+          OPENMS_LOG_FATAL_ERROR << "ConsensusID on idXML without the --per_spectrum flag, expects a single idXML file."
+          "Please merge the files with IDMerger using its default settings.\n";
@@
-          OPENMS_LOG_FATAL_ERROR << "ConsensusID on idXML without the --per_spectrum flag expects a merged idXML file"
-          "with multiple runs. Only one run found in the first file." << std::endl;
+          OPENMS_LOG_FATAL_ERROR << "ConsensusID on idXML without the --per_spectrum flag expects a merged idXML file"
+          "with multiple runs. Only one run found in the first file.\n";
@@
-            OPENMS_LOG_FATAL_ERROR << "Peptide ID without RT and/or m/z information found in identification run '" + run_id + "'.\nMake sure that this information is included for all IDs when generating/converting search results. Aborting!" << endl;
+            OPENMS_LOG_FATAL_ERROR << "Peptide ID without RT and/or m/z information found in identification run '" + run_id + "'.\nMake sure that this information is included for all IDs when generating/converting search results. Aborting!\n";

Also applies to: 831-832

src/openms/source/ANALYSIS/TARGETED/MetaboTargetedAssay.cpp (1)

44-44: Consider replacing std::endl with '\n' for consistency.

The coding guidelines specify to never use std::endl and to use '\n' for performance. While the PR objectives mention that std::endl is retained for error/warning messages requiring immediate flushing, the macro OPENMS_LOG_WARN may already handle flushing appropriately. Consider using '\n' here unless immediate flushing is explicitly required.

Proposed change
-      OPENMS_LOG_WARN << "The adduct had the suffix '" << adduct_suffix << "', but only singly positive or singly negative charged adducts are supported." << std::endl;
+      OPENMS_LOG_WARN << "The adduct had the suffix '" << adduct_suffix << "', but only singly positive or singly negative charged adducts are supported.\n";
src/openms/source/CONCEPT/LogConfigHandler.cpp (1)

292-321: Mapping to getGlobalLog*() is fine; consider table-driven lookup (and ensure headers declare these).

The new getLogStreamByName_ mapping (Line 294-315) matches the accessor-based design and keeps behavior intact.

Optional: replace the if/else chain with a static const lookup table to reduce branching/duplication.

Please also confirm this file includes (directly or indirectly) the header that declares getGlobalLogDebug/Info/Warn/Error/Fatal so this compiles across build configurations.

src/openms/source/FORMAT/ConsensusXMLFile.cpp (1)

46-51: Good migration to getGlobalLogWarn(); consider removing the remaining std::cerr warning path.

On Line 46, passing &getGlobalLogWarn() into isMapConsistent() matches the new logging access pattern.

As per coding guidelines/learnings, consider migrating the subsequent std::cerr << ... << std::endl; warning emission to OPENMS_LOG_WARN (and \n), so warnings go through the configured logging sinks. Based on learnings, use OpenMS logging macros instead of std::cout/std::cerr.

src/openms/include/OpenMS/CONCEPT/LogStream.h (1)

460-488: Consider adding full Doxygen documentation to thread-local accessors.

The thread-local accessor declarations use brief single-line comments (/// @brief), while the global accessors (lines 528-604) have comprehensive Doxygen blocks with @warning, @return, and @see tags. For consistency and to help developers understand the thread-safety guarantees, consider adding similar documentation to the thread-local accessors.

The restriction documentation block (lines 467-471) is valuable context.

Example documentation expansion for one accessor
-  /// @brief Get thread-local fatal error log stream
-  OPENMS_DLLAPI Logger::LogStream& getThreadLocalLogFatal();
+  /**
+    @brief Get thread-local fatal error log stream.
+
+    Returns a thread-local LogStream instance for fatal error logging.
+    Thread-local streams are safe for concurrent use across threads.
+
+    @note Thread-local streams copy configuration from globals on first access.
+          Configure logging before spawning threads.
+
+    @return Reference to the thread-local fatal error log stream
+
+    @see OPENMS_LOG_FATAL_ERROR
+  */
+  OPENMS_DLLAPI Logger::LogStream& getThreadLocalLogFatal();
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a04d7e and 0f30dae.

📒 Files selected for processing (34)
  • src/openms/include/OpenMS/CONCEPT/LogConfigHandler.h
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms/source/ANALYSIS/ID/IDBoostGraph.cpp
  • src/openms/source/ANALYSIS/MAPMATCHING/PoseClusteringAffineSuperimposer.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/PeakPickerChromatogram.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/QUANTITATION/IsotopeLabelingMDVs.cpp
  • src/openms/source/ANALYSIS/TARGETED/MetaboTargetedAssay.cpp
  • src/openms/source/APPLICATIONS/SearchEngineBase.cpp
  • src/openms/source/APPLICATIONS/TOPPBase.cpp
  • src/openms/source/CONCEPT/LogConfigHandler.cpp
  • src/openms/source/DATASTRUCTURES/Param.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
  • src/openms/source/FORMAT/ConsensusXMLFile.cpp
  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/FLASHDeconvWizard.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/SwathWizard.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/TOPPAS.cpp
  • src/openms_gui/source/VISUAL/DIALOGS/SwathTabWidget.cpp
  • src/openms_gui/source/VISUAL/DIALOGS/TOPPViewPrefDialog.cpp
  • src/tests/class_tests/openms/source/LogConfigHandler_test.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/tests/class_tests/openms/source/Param_test.cpp
  • src/topp/ConsensusID.cpp
  • src/topp/FileInfo.cpp
  • src/topp/IsobaricWorkflow.cpp
  • src/topp/OpenPepXL.cpp
  • src/topp/PeptideIndexer.cpp
  • src/topp/PhosphoScoring.cpp
  • src/topp/ProteomicsLFQ.cpp
  • src/topp/SequenceCoverageCalculator.cpp
  • src/topp/XFDR.cpp
✅ Files skipped from review due to trivial changes (2)
  • src/topp/IsobaricWorkflow.cpp
  • src/openms/include/OpenMS/CONCEPT/LogConfigHandler.h
🚧 Files skipped from review as they are similar to previous changes (5)
  • src/openms/source/DATASTRUCTURES/Param.cpp
  • src/openms/source/FORMAT/XQuestResultXMLFile.cpp
  • src/openms/source/ANALYSIS/MAPMATCHING/PoseClusteringAffineSuperimposer.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/PeakPickerChromatogram.cpp
  • src/tests/class_tests/openms/source/Param_test.cpp
🧰 Additional context used
📓 Path-based instructions (14)
src/openms/**/*.{cpp,h,hpp,cc,cxx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms

Files:

  • src/openms/source/ANALYSIS/QUANTITATION/IsotopeLabelingMDVs.cpp
  • src/openms/source/ANALYSIS/ID/IDBoostGraph.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/TARGETED/MetaboTargetedAssay.cpp
  • src/openms/source/APPLICATIONS/TOPPBase.cpp
  • src/openms/source/FORMAT/ConsensusXMLFile.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
  • src/openms/source/APPLICATIONS/SearchEngineBase.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/openms/source/CONCEPT/LogConfigHandler.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
**/*.{cpp,cc,cxx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{cpp,cc,cxx}: Never use std::cout or std::cerr directly; use OpenMS logging macros instead
Always use braces for control structures, even for single-line blocks (trivial one-liners may stay single-line)
Braces for control structures must align with opening/closing braces on their own lines

Files:

  • src/openms/source/ANALYSIS/QUANTITATION/IsotopeLabelingMDVs.cpp
  • src/topp/FileInfo.cpp
  • src/openms/source/ANALYSIS/ID/IDBoostGraph.cpp
  • src/topp/PhosphoScoring.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/TARGETED/MetaboTargetedAssay.cpp
  • src/topp/PeptideIndexer.cpp
  • src/openms/source/APPLICATIONS/TOPPBase.cpp
  • src/openms/source/FORMAT/ConsensusXMLFile.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/topp/SequenceCoverageCalculator.cpp
  • src/tests/class_tests/openms/source/LogConfigHandler_test.cpp
  • src/topp/ConsensusID.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
  • src/topp/OpenPepXL.cpp
  • src/openms/source/APPLICATIONS/SearchEngineBase.cpp
  • src/topp/XFDR.cpp
  • src/openms_gui/source/VISUAL/DIALOGS/SwathTabWidget.cpp
  • src/openms_gui/source/VISUAL/DIALOGS/TOPPViewPrefDialog.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/FLASHDeconvWizard.cpp
  • src/topp/ProteomicsLFQ.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/TOPPAS.cpp
  • src/openms/source/CONCEPT/LogConfigHandler.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/SwathWizard.cpp
**/*.{cpp,cc,cxx,h,hpp,hxx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{cpp,cc,cxx,h,hpp,hxx}: Never use std::endl; use \n for performance
Use 2-space indentation for C++/headers; no tabs; Unix line endings
Use classes/types/namespaces in PascalCase
Use lowerCamelCase for method names
Use snake_case for variable names
Use trailing underscore for private/protected member variable names
Use UPPER_SNAKE_CASE for enums and macros
Include space after keywords (if, for, while) and around binary operators
Avoid the C++ preprocessor; prefer enum class over macro constants

Files:

  • src/openms/source/ANALYSIS/QUANTITATION/IsotopeLabelingMDVs.cpp
  • src/topp/FileInfo.cpp
  • src/openms/source/ANALYSIS/ID/IDBoostGraph.cpp
  • src/topp/PhosphoScoring.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/TARGETED/MetaboTargetedAssay.cpp
  • src/topp/PeptideIndexer.cpp
  • src/openms/source/APPLICATIONS/TOPPBase.cpp
  • src/openms/source/FORMAT/ConsensusXMLFile.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/topp/SequenceCoverageCalculator.cpp
  • src/tests/class_tests/openms/source/LogConfigHandler_test.cpp
  • src/topp/ConsensusID.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
  • src/topp/OpenPepXL.cpp
  • src/openms/source/APPLICATIONS/SearchEngineBase.cpp
  • src/topp/XFDR.cpp
  • src/openms_gui/source/VISUAL/DIALOGS/SwathTabWidget.cpp
  • src/openms_gui/source/VISUAL/DIALOGS/TOPPViewPrefDialog.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/FLASHDeconvWizard.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/topp/ProteomicsLFQ.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/TOPPAS.cpp
  • src/openms/source/CONCEPT/LogConfigHandler.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/SwathWizard.cpp
src/openms/**/*.{cpp,cc,cxx,h,hpp,hxx}

📄 CodeRabbit inference engine (AGENTS.md)

src/openms/**/*.{cpp,cc,cxx,h,hpp,hxx}: Prefer OpenMS::String for numeric formatting and parsing instead of standard stream operators
Use Size/SignedSize types for STL .size() values instead of raw integers
Use OpenMS primitive types from OpenMS/CONCEPT/Types.h
Derive custom exceptions from Exception::Base; throw with file/line/OPENMS_PRETTY_FUNCTION; catch by reference
Avoid pointers; prefer references in C++ code
Use OpenMS/CONCEPT/Types.h primitive types instead of standard C++ types for consistency
Use lower_case_with_underscores for method/function parameters and document ranges/units

Files:

  • src/openms/source/ANALYSIS/QUANTITATION/IsotopeLabelingMDVs.cpp
  • src/openms/source/ANALYSIS/ID/IDBoostGraph.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/TARGETED/MetaboTargetedAssay.cpp
  • src/openms/source/APPLICATIONS/TOPPBase.cpp
  • src/openms/source/FORMAT/ConsensusXMLFile.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
  • src/openms/source/APPLICATIONS/SearchEngineBase.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/openms/source/CONCEPT/LogConfigHandler.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
src/openms/source/**/*.{cpp,cc,cxx}

📄 CodeRabbit inference engine (AGENTS.md)

Include at least ~5% of code as comments in C++ using // style, plain English describing the next few lines

Files:

  • src/openms/source/ANALYSIS/QUANTITATION/IsotopeLabelingMDVs.cpp
  • src/openms/source/ANALYSIS/ID/IDBoostGraph.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/TARGETED/MetaboTargetedAssay.cpp
  • src/openms/source/APPLICATIONS/TOPPBase.cpp
  • src/openms/source/FORMAT/ConsensusXMLFile.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
  • src/openms/source/APPLICATIONS/SearchEngineBase.cpp
  • src/openms/source/CONCEPT/LogConfigHandler.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
src/openms/**/*.{h,hpp,hxx,cpp,cc,cxx}

📄 CodeRabbit inference engine (AGENTS.md)

Include $Maintainer:$ marker in file preamble of every header and source file

Files:

  • src/openms/source/ANALYSIS/QUANTITATION/IsotopeLabelingMDVs.cpp
  • src/openms/source/ANALYSIS/ID/IDBoostGraph.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/TARGETED/MetaboTargetedAssay.cpp
  • src/openms/source/APPLICATIONS/TOPPBase.cpp
  • src/openms/source/FORMAT/ConsensusXMLFile.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
  • src/openms/source/APPLICATIONS/SearchEngineBase.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/openms/source/CONCEPT/LogConfigHandler.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
src/openms/**/*.{cpp,cc,cxx}

📄 CodeRabbit inference engine (AGENTS.md)

Use OPENMS_LOG_WARN, OPENMS_LOG_INFO, and other OpenMS logging macros instead of std::cout or std::cerr

Files:

  • src/openms/source/ANALYSIS/QUANTITATION/IsotopeLabelingMDVs.cpp
  • src/openms/source/ANALYSIS/ID/IDBoostGraph.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/TARGETED/MetaboTargetedAssay.cpp
  • src/openms/source/APPLICATIONS/TOPPBase.cpp
  • src/openms/source/FORMAT/ConsensusXMLFile.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
  • src/openms/source/APPLICATIONS/SearchEngineBase.cpp
  • src/openms/source/CONCEPT/LogConfigHandler.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
src/topp/**/*.cpp

📄 CodeRabbit inference engine (AGENTS.md)

src/topp/**/*.cpp: Define tool parameters in registerOptionsAndFlags_() method and read with getStringOption_ and related helpers
Use ProgressLogger in TOPP tools for progress reporting

Files:

  • src/topp/FileInfo.cpp
  • src/topp/PhosphoScoring.cpp
  • src/topp/PeptideIndexer.cpp
  • src/topp/SequenceCoverageCalculator.cpp
  • src/topp/ConsensusID.cpp
  • src/topp/OpenPepXL.cpp
  • src/topp/XFDR.cpp
  • src/topp/ProteomicsLFQ.cpp
src/tests/class_tests/openms/**/*.cpp

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Write unit tests for new functionality

Files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/tests/class_tests/openms/source/LogConfigHandler_test.cpp
src/tests/class_tests/openms/source/**/*_test.cpp

📄 CodeRabbit inference engine (AGENTS.md)

src/tests/class_tests/openms/source/**/*_test.cpp: Use START_SECTION and END_SECTION macros in C++ unit tests; wrap template methods with 2+ arguments in parentheses
Use NEW_TMP_FILE macro for each output file in tests to avoid side effects
Wrap template methods with 2+ arguments in parentheses when used with START_SECTION macro

Files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/tests/class_tests/openms/source/LogConfigHandler_test.cpp
src/openms/include/OpenMS/**/*.h

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Add Doxygen comments for new public methods and classes

Files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
**/*.{h,hpp,hxx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{h,hpp,hxx}: Never add using namespace or using std::... in header files; allowed in .cpp files only
Follow the Rule-of-0 or Rule-of-6 for class definitions; no user-defined destructors unless necessary

Files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
src/openms/include/**/*.{h,hpp,hxx}

📄 CodeRabbit inference engine (AGENTS.md)

src/openms/include/**/*.{h,hpp,hxx}: Add OPENMS_DLLAPI macro on all non-template exported classes, structs, functions, and variables; include in friend operator declarations
Use getter/setter pairs (get/set methods) for protected/private members; no reference getters for primitive types
Use Doxygen documentation with /** */ block comments and @ tags (not \ backslash); @brief is required
Include @param[in], @param[out], or @param[in,out] direction tags for all method parameters in Doxygen documentation
Prefer forward declarations in headers; include only base class headers, non-pointer members, and templates
Always implement and include $Maintainer: marker in file headers, along with $Authors: and copyright notice

Files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
src/openms/include/**/*.h

📄 CodeRabbit inference engine (AGENTS.md)

Use templates with _impl.h only when needed; .h files must not include _impl.h

Files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
🧠 Learnings (36)
📓 Common learnings
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Utilize OpenMS logging mechanisms
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/openms/**/*.{cpp,cc,cxx} : Use `OPENMS_LOG_WARN`, `OPENMS_LOG_INFO`, and other OpenMS logging macros instead of `std::cout` or `std::cerr`
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/openms/**/*.{cpp,cc,cxx} : Use `OPENMS_LOG_WARN`, `OPENMS_LOG_INFO`, and other OpenMS logging macros instead of `std::cout` or `std::cerr`

Applied to files:

  • src/openms/source/ANALYSIS/QUANTITATION/IsotopeLabelingMDVs.cpp
  • src/topp/FileInfo.cpp
  • src/openms/source/ANALYSIS/ID/IDBoostGraph.cpp
  • src/topp/PhosphoScoring.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/TARGETED/MetaboTargetedAssay.cpp
  • src/topp/PeptideIndexer.cpp
  • src/openms/source/APPLICATIONS/TOPPBase.cpp
  • src/openms/source/FORMAT/ConsensusXMLFile.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/topp/SequenceCoverageCalculator.cpp
  • src/tests/class_tests/openms/source/LogConfigHandler_test.cpp
  • src/topp/ConsensusID.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
  • src/topp/OpenPepXL.cpp
  • src/openms/source/APPLICATIONS/SearchEngineBase.cpp
  • src/topp/XFDR.cpp
  • src/openms_gui/source/VISUAL/DIALOGS/SwathTabWidget.cpp
  • src/openms_gui/source/VISUAL/DIALOGS/TOPPViewPrefDialog.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/FLASHDeconvWizard.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/topp/ProteomicsLFQ.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/TOPPAS.cpp
  • src/openms/source/CONCEPT/LogConfigHandler.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/SwathWizard.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Utilize OpenMS logging mechanisms

Applied to files:

  • src/openms/source/ANALYSIS/QUANTITATION/IsotopeLabelingMDVs.cpp
  • src/topp/FileInfo.cpp
  • src/openms/source/ANALYSIS/ID/IDBoostGraph.cpp
  • src/topp/PhosphoScoring.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/TARGETED/MetaboTargetedAssay.cpp
  • src/topp/PeptideIndexer.cpp
  • src/openms/source/APPLICATIONS/TOPPBase.cpp
  • src/openms/source/FORMAT/ConsensusXMLFile.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/topp/SequenceCoverageCalculator.cpp
  • src/tests/class_tests/openms/source/LogConfigHandler_test.cpp
  • src/topp/ConsensusID.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
  • src/topp/OpenPepXL.cpp
  • src/openms/source/APPLICATIONS/SearchEngineBase.cpp
  • src/topp/XFDR.cpp
  • src/openms_gui/source/VISUAL/DIALOGS/SwathTabWidget.cpp
  • src/openms_gui/source/VISUAL/DIALOGS/TOPPViewPrefDialog.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/FLASHDeconvWizard.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/topp/ProteomicsLFQ.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/TOPPAS.cpp
  • src/openms/source/CONCEPT/LogConfigHandler.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/SwathWizard.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to **/*.{cpp,cc,cxx} : Never use `std::cout` or `std::cerr` directly; use OpenMS logging macros instead

Applied to files:

  • src/openms/source/ANALYSIS/QUANTITATION/IsotopeLabelingMDVs.cpp
  • src/topp/FileInfo.cpp
  • src/topp/PhosphoScoring.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/TARGETED/MetaboTargetedAssay.cpp
  • src/openms/source/APPLICATIONS/TOPPBase.cpp
  • src/openms/source/FORMAT/ConsensusXMLFile.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/topp/SequenceCoverageCalculator.cpp
  • src/tests/class_tests/openms/source/LogConfigHandler_test.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
  • src/topp/OpenPepXL.cpp
  • src/topp/XFDR.cpp
  • src/openms_gui/source/VISUAL/DIALOGS/SwathTabWidget.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/FLASHDeconvWizard.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/topp/ProteomicsLFQ.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/TOPPAS.cpp
  • src/openms/source/CONCEPT/LogConfigHandler.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/SwathWizard.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Follow the established error handling patterns

Applied to files:

  • src/openms/source/ANALYSIS/QUANTITATION/IsotopeLabelingMDVs.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/TARGETED/MetaboTargetedAssay.cpp
  • src/openms/source/APPLICATIONS/TOPPBase.cpp
  • src/openms/source/FORMAT/ConsensusXMLFile.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/topp/SequenceCoverageCalculator.cpp
  • src/tests/class_tests/openms/source/LogConfigHandler_test.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/FLASHDeconvWizard.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/TOPPAS.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/SwathWizard.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/topp/**/*.cpp : Use `ProgressLogger` in TOPP tools for progress reporting

Applied to files:

  • src/topp/FileInfo.cpp
  • src/openms/source/ANALYSIS/ID/IDBoostGraph.cpp
  • src/topp/PhosphoScoring.cpp
  • src/topp/PeptideIndexer.cpp
  • src/openms/source/APPLICATIONS/TOPPBase.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/topp/SequenceCoverageCalculator.cpp
  • src/topp/ConsensusID.cpp
  • src/topp/OpenPepXL.cpp
  • src/topp/XFDR.cpp
  • src/openms_gui/source/VISUAL/DIALOGS/TOPPViewPrefDialog.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/FLASHDeconvWizard.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/topp/ProteomicsLFQ.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/TOPPAS.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/SwathWizard.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/tests/class_tests/openms/source/**/*_test.cpp : Use `NEW_TMP_FILE` macro for each output file in tests to avoid side effects

Applied to files:

  • src/topp/FileInfo.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/tests/class_tests/openms/source/LogConfigHandler_test.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/openms/**/*.{cpp,cc,cxx,h,hpp,hxx} : Prefer `OpenMS::String` for numeric formatting and parsing instead of standard stream operators

Applied to files:

  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/FLASHDeconvWizard.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/TOPPAS.cpp
  • src/openms/source/CONCEPT/LogConfigHandler.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/openms/**/*.{cpp,cc,cxx,h,hpp,hxx} : Use lower_case_with_underscores for method/function parameters and document ranges/units

Applied to files:

  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/TARGETED/MetaboTargetedAssay.cpp
  • src/openms/source/APPLICATIONS/TOPPBase.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/TOPPAS.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to **/*.{cpp,cc,cxx,h,hpp,hxx} : Never use `std::endl`; use `\n` for performance

Applied to files:

  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Be mindful of memory usage when processing large datasets

Applied to files:

  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Consider algorithmic complexity for data processing operations

Applied to files:

  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/**/*.cpp : Write unit tests for new functionality

Applied to files:

  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/tests/class_tests/openms/source/LogConfigHandler_test.cpp
📚 Learning: 2025-10-21T13:02:16.431Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8318
File: src/openms/include/OpenMS/ML/CLUSTERING/HashGrid.h:466-480
Timestamp: 2025-10-21T13:02:16.431Z
Learning: In OpenMS, when making internal methods public (e.g., in HashGrid.h), remove XXX/TODO comments about implementation details rather than documenting them in the public API documentation.

Applied to files:

  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/tests/class_tests/openms/source/**/*_test.cpp : Use `START_SECTION` and `END_SECTION` macros in C++ unit tests; wrap template methods with 2+ arguments in parentheses

Applied to files:

  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
  • src/openms/source/APPLICATIONS/TOPPBase.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/tests/class_tests/openms/source/LogConfigHandler_test.cpp
📚 Learning: 2025-08-29T19:09:45.997Z
Learnt from: jcharkow
Repo: OpenMS/OpenMS PR: 8188
File: src/topp/OpenSwathWorkflow.cpp:1118-1123
Timestamp: 2025-08-29T19:09:45.997Z
Learning: In OpenMS OpenSwathWorkflow, the use_ms1_ion_mobility parameter should be respected when applying estimated MS1 ion mobility extraction windows. The apply_window calls for MS1 ion mobility should check both pasef AND use_ms1_ion_mobility to avoid re-enabling disabled functionality.

Applied to files:

  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
📚 Learning: 2025-04-07T21:16:06.557Z
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.

Applied to files:

  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
📚 Learning: 2025-12-04T16:25:07.026Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp:5069-5074
Timestamp: 2025-12-04T16:25:07.026Z
Learning: In OpenMS mzML writing, PSI-MS term MS:1003441 "ion mobility centroid frame" is a spectrum-level cvParam. It should be written at spectrum level (not scan level).

Applied to files:

  • src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp
📚 Learning: 2026-01-07T06:33:27.217Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.217Z
Learning: Register TOPP tools in `src/openms/source/APPLICATIONS/ToolHandler.cpp` to generate Doxygen help output

Applied to files:

  • src/openms/source/APPLICATIONS/TOPPBase.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/FLASHDeconvWizard.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/TOPPAS.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/SwathWizard.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/topp/**/*.cpp : Define tool parameters in `registerOptionsAndFlags_()` method and read with `getStringOption_` and related helpers

Applied to files:

  • src/openms/source/APPLICATIONS/TOPPBase.cpp
  • src/topp/OpenPepXL.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/FLASHDeconvWizard.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/TOPPAS.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/SwathWizard.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/openms/**/*.{cpp,cc,cxx,h,hpp,hxx} : Use OpenMS primitive types from `OpenMS/CONCEPT/Types.h`

Applied to files:

  • src/openms/source/APPLICATIONS/TOPPBase.cpp
  • src/openms/source/CONCEPT/LogConfigHandler.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/openms/**/*.{cpp,cc,cxx,h,hpp,hxx} : Derive custom exceptions from `Exception::Base`; throw with file/line/`OPENMS_PRETTY_FUNCTION`; catch by reference

Applied to files:

  • src/openms/source/FORMAT/ConsensusXMLFile.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)

Applied to files:

  • src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/*Test.cpp : Follow naming convention: `ClassNameTest.cpp` for `ClassName`

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/tests/class_tests/openms/source/LogConfigHandler_test.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/tests/class_tests/openms/source/**/*_test.cpp : Wrap template methods with 2+ arguments in parentheses when used with `START_SECTION` macro

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/tests/class_tests/openms/source/LogConfigHandler_test.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/tests/class_tests/openms_gui/source/**/*_test.cpp : GUI tests must be located in `src/tests/class_tests/openms_gui/source/` and use Qt TestLib framework

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/tests/class_tests/openms/source/LogConfigHandler_test.cpp
📚 Learning: 2025-09-03T12:58:20.032Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/tests/topp/CMakeLists.txt:1857-1865
Timestamp: 2025-09-03T12:58:20.032Z
Learning: OpenMS tests: When adding new TOPP tests in src/tests/topp/CMakeLists.txt that compare outputs via FuzzyDiff, always add set_tests_properties("<tool>_<n>_out<m>" PROPERTIES DEPENDS "<tool>_<n>") to avoid flakiness under parallel CTest runs.

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2025-09-16T10:59:20.544Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8208
File: src/openms/source/FORMAT/MzParquetFile.cpp:127-146
Timestamp: 2025-09-16T10:59:20.544Z
Learning: Throwing exceptions from within OpenMP critical sections (#pragma omp critical) can cause undefined behavior and deadlocks because the critical section may not be properly released during exception unwinding. Always avoid throwing exceptions from within OpenMP synchronization constructs.

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/openms/include/**/*.{h,hpp,hxx} : Prefer forward declarations in headers; include only base class headers, non-pointer members, and templates

Applied to files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/tests/topp/**/*.cpp : Use `FuzzyDiff` tool for numeric tolerance comparisons in TOPP tests instead of exact comparisons

Applied to files:

  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/TOPPAS.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/tests/topp/**/*.cpp : Use `FuzzyDiff` for numeric comparisons in TOPP tests; keep test data small

Applied to files:

  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/TOPPAS.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/openms/include/**/*.{h,hpp,hxx} : Use getter/setter pairs (get/set methods) for protected/private members; no reference getters for primitive types

Applied to files:

  • src/openms/source/CONCEPT/LogConfigHandler.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use the established naming patterns for classes, methods, and variables

Applied to files:

  • src/openms/source/CONCEPT/LogConfigHandler.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/openms/**/*.{cpp,cc,cxx,h,hpp,hxx} : Use `OpenMS/CONCEPT/Types.h` primitive types instead of standard C++ types for consistency

Applied to files:

  • src/openms/source/CONCEPT/LogConfigHandler.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Follow the existing C++ coding conventions in the codebase

Applied to files:

  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
📚 Learning: 2026-01-07T06:33:27.218Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-07T06:33:27.218Z
Learning: Applies to src/openms/**/*.{cpp,cc,cxx,h,hpp,hxx} : Avoid pointers; prefer references in C++ code

Applied to files:

  • src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp
🧬 Code graph analysis (10)
src/topp/PhosphoScoring.cpp (1)
src/openms/source/APPLICATIONS/TOPPBase.cpp (4)
  • getParam_ (1835-1847)
  • getParam_ (1835-1835)
  • getParam_ (1849-1852)
  • getParam_ (1849-1849)
src/openms/source/ANALYSIS/OPENSWATH/SwathMapMassCorrection.cpp (2)
src/openms/source/FORMAT/OSWFile.cpp (1)
  • tr (647-651)
src/openms/source/DATASTRUCTURES/Param.cpp (2)
  • os (1032-1049)
  • os (1032-1032)
src/topp/SequenceCoverageCalculator.cpp (1)
src/topp/FileInfo.cpp (1)
  • out (2189-2229)
src/tests/class_tests/openms/source/LogConfigHandler_test.cpp (2)
src/openms/source/CONCEPT/LogStream.cpp (6)
  • getGlobalLogInfo (626-626)
  • getGlobalLogInfo (626-626)
  • getGlobalLogWarn (625-625)
  • getGlobalLogWarn (625-625)
  • getGlobalLogError (624-624)
  • getGlobalLogError (624-624)
src/openms/source/CONCEPT/LogConfigHandler.cpp (2)
  • getInstance (428-435)
  • getInstance (428-428)
src/topp/ConsensusID.cpp (1)
src/openms/source/APPLICATIONS/TOPPBase.cpp (4)
  • getParam_ (1835-1847)
  • getParam_ (1835-1835)
  • getParam_ (1849-1852)
  • getParam_ (1849-1849)
src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/FLASHDeconvWizard.cpp (2)
src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/SwathWizard.cpp (2)
  • print_usage (129-142)
  • print_usage (129-129)
src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/TOPPAS.cpp (2)
  • print_usage (73-86)
  • print_usage (73-73)
src/openms/include/OpenMS/CONCEPT/LogStream.h (1)
src/openms/source/CONCEPT/LogStream.cpp (31)
  • LogStreamBuf (42-49)
  • LogStreamBuf (51-63)
  • LogStreamBuf (75-88)
  • getStreamList_ (65-68)
  • getStreamList_ (65-65)
  • getStreamList_ (70-73)
  • getStreamList_ (70-70)
  • flushIncomplete (585-597)
  • flushIncomplete (585-585)
  • LogStream (441-450)
  • LogStream (452-461)
  • getThreadLocalLogFatal (634-638)
  • getThreadLocalLogFatal (634-634)
  • getThreadLocalLogError (640-644)
  • getThreadLocalLogError (640-640)
  • getThreadLocalLogWarn (646-650)
  • getThreadLocalLogWarn (646-646)
  • getThreadLocalLogInfo (652-656)
  • getThreadLocalLogInfo (652-652)
  • getThreadLocalLogDebug (658-662)
  • getThreadLocalLogDebug (658-658)
  • getGlobalLogFatal (623-623)
  • getGlobalLogFatal (623-623)
  • getGlobalLogError (624-624)
  • getGlobalLogError (624-624)
  • getGlobalLogWarn (625-625)
  • getGlobalLogWarn (625-625)
  • getGlobalLogInfo (626-626)
  • getGlobalLogInfo (626-626)
  • getGlobalLogDebug (627-627)
  • getGlobalLogDebug (627-627)
src/openms/source/CONCEPT/LogConfigHandler.cpp (1)
src/openms/source/CONCEPT/LogStream.cpp (10)
  • getGlobalLogDebug (627-627)
  • getGlobalLogDebug (627-627)
  • getGlobalLogInfo (626-626)
  • getGlobalLogInfo (626-626)
  • getGlobalLogWarn (625-625)
  • getGlobalLogWarn (625-625)
  • getGlobalLogError (624-624)
  • getGlobalLogError (624-624)
  • getGlobalLogFatal (623-623)
  • getGlobalLogFatal (623-623)
src/openms/source/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.cpp (1)
src/topp/FLASHDeconv.cpp (1)
  • OPENMS_LOG_INFO (170-436)
src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/SwathWizard.cpp (2)
src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/FLASHDeconvWizard.cpp (2)
  • print_usage (59-71)
  • print_usage (59-59)
src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/TOPPAS.cpp (2)
  • print_usage (73-86)
  • print_usage (73-73)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: build-and-test (macos-14, xcode, 15.4)
  • GitHub Check: build-and-test (ubuntu-24.04-arm, g++, 13)
  • GitHub Check: build-and-test (ubuntu-24.04, clang++, 17)
  • GitHub Check: build-and-test (ubuntu-24.04, g++, 13)
  • GitHub Check: build-and-test (windows-2025, cl.exe, 14.44)
  • GitHub Check: build-macos-arm
  • GitHub Check: build-lnx-arm
  • GitHub Check: build-lnx
  • GitHub Check: build-win
  • GitHub Check: cppcheck-test

Comment thread src/topp/ConsensusID.cpp Resolved
timosachsenberg and others added 2 commits January 10, 2026 14:35
The manual remove()/insert() pattern around pickExperiment() was not
exception-safe - if pickExperiment throws, cout would never be
re-inserted into the info log stream.

- Add Logger::LogSinkGuard class that re-inserts a stream on scope exit
- Update FeatureFinderAlgorithmMetaboIdent to use LogSinkGuard
- Update FeatureFinderIdentificationAlgorithm to use std::optional<LogSinkGuard>
  for conditional logging suppression
- Add unit tests for LogSinkGuard covering normal exit, exceptions, and nesting

Co-Authored-By: Claude Opus 4.5 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/openms/include/OpenMS/CONCEPT/LogStream.h (1)

199-201: Consider adding Doxygen comments for protected accessor methods.

While not strictly required for protected methods, adding brief documentation would help maintainers understand the purpose of these accessors and when they should be used.

📝 Suggested documentation
+    /// @brief Get mutable access to the stream list
+    /// @return Reference to the list of associated streams
     std::list<StreamStruct>& getStreamList_();
+    /// @brief Get const access to the stream list
+    /// @return Const reference to the list of associated streams
     const std::list<StreamStruct>& getStreamList_() const;
src/tests/class_tests/openms/source/LogStream_test.cpp (1)

55-102: Thread-local OpenMP tests properly validate thread safety.

The tests correctly verify that parallel logging doesn't crash or corrupt data. The comments (lines 57-60) clearly explain why capture streams can't be used with thread-local loggers.

Minor observation: TEST_EQUAL(true, true) (lines 76, 99) is unconventional for crash tests. Consider using NOT_TESTABLE with a comment, but the current approach is acceptable.

♻️ Alternative test pattern (optional)
-    // If we get here without crashing, the test passes
-    TEST_EQUAL(true, true)
+    // Crash test: if we reach here, parallel logging is thread-safe
+    NOT_TESTABLE
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0f30dae and fcfc540.

📒 Files selected for processing (4)
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
🧰 Additional context used
📓 Path-based instructions (7)
src/tests/class_tests/openms/**/*.cpp

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Write unit tests for new functionality

Files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
**/*.{h,cpp}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{h,cpp}: Use 2-space indentation for C++ and header files; no tabs; Unix line endings (LF)
All non-template exported classes, structs, functions, and variables must use OPENMS_DLLAPI macro; templates are exempt
One class per file; class name must match file name exactly
Always pair .h header files with .cpp implementation files
Class and type names must use PascalCase; methods must use lowerCamelCase; variables must use snake_case
Private and protected member variables must end with trailing underscore _
Enum names and macro definitions must use UPPER_SNAKE_CASE; prefer enum class over C-style enums
Use OpenMS primitive types from OpenMS/CONCEPT/Types.h instead of standard C++ types
Use Size/SignedSize types for STL .size() values instead of standard integer types
Prefer references over pointers in C++ code
Use Rule-of-0 (no explicit copy/move) or Rule-of-6 (all copy/move/destroy); never use Rule-of-5
Accessor methods must use get/set pairs for protected/private members; do not return references to primitive types
All exceptions must derive from Exception::Base; throw with file, line, and OPENMS_PRETTY_FUNCTION; catch by reference
Code comments must use // style; should comprise at least ~5% of code; describe the next few lines in plain English
Use .clang-format configuration from repository root for code formatting; check with clang-format --dry-run -Werror
Use OpenMS logging macros and OpenMS::LogStream; avoid std::cout and std::cerr
Avoid std::endl; prefer \n for better performance
Prefer OpenMS::String for numeric formatting and parsing
Braces must be on their own lines and aligned; always use braces even for single-line blocks (trivial one-liners may remain single-line)
Space required after keywords (if, for, while) and around binary operators

Files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
**

📄 CodeRabbit inference engine (AGENTS.md)

File extensions must be lowercase except for ML, XML, and mzData

Files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
src/tests/class_tests/openms/source/*_test.cpp

📄 CodeRabbit inference engine (AGENTS.md)

src/tests/class_tests/openms/source/*_test.cpp: Unit tests must be placed in src/tests/class_tests/openms/source/ with naming pattern ClassName_test.cpp
Use NEW_TMP_FILE(filename) macro for each output file in tests to avoid side effects
Use FuzzyDiff for numeric comparisons in tests instead of exact equality checks
Use START_SECTION and END_SECTION macros in unit tests; wrap template methods with 2+ arguments in parentheses

Files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
src/openms/**/*.{cpp,h,hpp,cc,cxx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms

Files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
src/openms/include/OpenMS/**/*.h

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Add Doxygen comments for new public methods and classes

Files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
**/*.h

📄 CodeRabbit inference engine (AGENTS.md)

**/*.h: Do not add using namespace or using std::... in header files; allowed only in .cpp files
Prefer forward declarations in headers; include only base class headers, non-pointer members, and templates
Document possible exceptions in Doxygen comments using @throws or @exception tags
Use Doxygen /** */ block comments with @ tags (not backslash \); @brief is required and must be followed by a blank line before details
All parameter documentation in Doxygen must include direction tags: [in], [out], or [in,out]
Use @ingroup and @defgroup Doxygen tags to organize classes and functions into categories
Use @todo tags with assignee name (e.g., @todo JohnDoe fix this) in Doxygen comments
Every .h file must include a file preamble with $Maintainer:$ marker

Files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
🧠 Learnings (16)
📓 Common learnings
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to **/*.{h,cpp} : Use OpenMS logging macros and `OpenMS::LogStream`; avoid `std::cout` and `std::cerr`
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Utilize OpenMS logging mechanisms
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to **/*.{h,cpp} : Use OpenMS logging macros and `OpenMS::LogStream`; avoid `std::cout` and `std::cerr`

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/**/*.cpp : Write unit tests for new functionality

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Utilize OpenMS logging mechanisms

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/tests/class_tests/openms/source/*_test.cpp : Use `NEW_TMP_FILE(filename)` macro for each output file in tests to avoid side effects

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/tests/class_tests/openms/source/*_test.cpp : Use `START_SECTION` and `END_SECTION` macros in unit tests; wrap template methods with 2+ arguments in parentheses

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/*Test.cpp : Follow naming convention: `ClassNameTest.cpp` for `ClassName`

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/tests/class_tests/openms/source/*_test.cpp : Unit tests must be placed in `src/tests/class_tests/openms/source/` with naming pattern `ClassName_test.cpp`

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/tests/class_tests/openms/source/*_test.cpp : Use `FuzzyDiff` for numeric comparisons in tests instead of exact equality checks

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2025-09-03T12:58:20.032Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/tests/topp/CMakeLists.txt:1857-1865
Timestamp: 2025-09-03T12:58:20.032Z
Learning: OpenMS tests: When adding new TOPP tests in src/tests/topp/CMakeLists.txt that compare outputs via FuzzyDiff, always add set_tests_properties("<tool>_<n>_out<m>" PROPERTIES DEPENDS "<tool>_<n>") to avoid flakiness under parallel CTest runs.

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/topp/*.cpp : Use `ProgressLogger` in TOPP tools for progress reporting

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2025-09-16T10:59:20.544Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8208
File: src/openms/source/FORMAT/MzParquetFile.cpp:127-146
Timestamp: 2025-09-16T10:59:20.544Z
Learning: Throwing exceptions from within OpenMP critical sections (#pragma omp critical) can cause undefined behavior and deadlocks because the critical section may not be properly released during exception unwinding. Always avoid throwing exceptions from within OpenMP synchronization constructs.

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Follow the established error handling patterns

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Consider algorithmic complexity for data processing operations

Applied to files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to **/*.{h,cpp} : All non-template exported classes, structs, functions, and variables must use `OPENMS_DLLAPI` macro; templates are exempt

Applied to files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Be mindful of memory usage when processing large datasets

Applied to files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
🧬 Code graph analysis (1)
src/tests/class_tests/openms/source/LogStream_test.cpp (1)
src/openms/source/CONCEPT/LogStream.cpp (10)
  • getThreadLocalLogFatal (634-638)
  • getThreadLocalLogFatal (634-634)
  • getThreadLocalLogError (640-644)
  • getThreadLocalLogError (640-640)
  • getThreadLocalLogWarn (646-650)
  • getThreadLocalLogWarn (646-646)
  • getThreadLocalLogInfo (652-656)
  • getThreadLocalLogInfo (652-652)
  • getThreadLocalLogDebug (658-662)
  • getThreadLocalLogDebug (658-658)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: build-and-test (windows-2025, cl.exe, 14.44)
  • GitHub Check: build-and-test (ubuntu-24.04, g++, 13)
  • GitHub Check: build-and-test (ubuntu-24.04, clang++, 17)
  • GitHub Check: build-and-test (macos-14, xcode, 15.4)
  • GitHub Check: build-and-test (ubuntu-24.04-arm, g++, 13)
  • GitHub Check: build-lnx-arm
  • GitHub Check: build-macos-arm
  • GitHub Check: build-win
  • GitHub Check: build-lnx
  • GitHub Check: cppcheck-test
🔇 Additional comments (6)
src/openms/include/OpenMS/CONCEPT/LogStream.h (4)

104-114: Well-documented thread-local initialization constructor.

The Doxygen documentation clearly explains the purpose of copying stream configuration for thread-local logging. The constructor signature and documentation follow OpenMS conventions.


434-440: Good documentation for thread-local flush operation.

The Doxygen comment clearly explains when and why this method is needed in the thread-local logging architecture.


458-506: LogSinkGuard RAII implementation is correct and well-documented.

The class properly implements the RAII pattern with:

  • Deleted copy/move operations (exception-safe)
  • Clear documentation with usage example
  • Proper destructor that re-inserts the stream

The pattern of requiring manual remove() before constructing the guard is unusual but acceptable. The documentation note on line 484 makes this clear.


510-656: Excellent documentation for the thread-local and global logging API.

The separation between thread-local logging (via macros) and global configuration (via accessors) is clearly documented with appropriate warnings. Key strengths:

  • Thread-local accessor documentation (lines 510-537) explains restrictions and race condition fixes
  • Macro updates (lines 544-565) correctly route through thread-local streams
  • Global accessor documentation (lines 567-656) has clear @warning tags against direct logging use
  • Consistent use of OPENMS_DLLAPI across all exported functions

This design properly addresses the data race issues mentioned in the PR objectives while maintaining backward compatibility for configuration operations.

src/tests/class_tests/openms/source/LogStream_test.cpp (2)

203-271: Comprehensive LogSinkGuard test coverage.

The test suite thoroughly validates the RAII behavior:

  • Normal scope exit (lines 205-225)
  • Exception safety (lines 227-249)
  • Nested guard scenarios (lines 251-269)

All three scenarios properly test the guard's ability to re-insert streams under different conditions.


457-577: Macro tests correctly validate thread-local logging behavior.

All five macro tests (FATAL_ERROR, ERROR, WARN, INFO, DEBUG) follow a consistent and correct pattern:

  1. clearCache() - flush any pending messages to old streams
  2. removeAllStreams() - ensure clean slate for thread-local stream
  3. insert(test_stream) - add test capture stream
  4. Log messages and verify
  5. remove(test_stream) - cleanup

The use of getThreadLocalLogXxx() accessors aligns with the new thread-local architecture. The comments mention "remove cout/cerr streams" but are clear enough in context.

@timosachsenberg

Copy link
Copy Markdown
Contributor Author

@cbielow I added a LogSinkGuard. I think it is ready to merge

timosachsenberg and others added 2 commits January 12, 2026 17:24
Address cbielow's code review feedback: LogSinkGuard now calls remove()
in its constructor instead of requiring a separate manual call. This:

- Eliminates the need to specify the stream twice (DRY)
- Prevents sync issues if one occurrence is changed but not the other
- Provides true RAII semantics (acquisition in constructor)
- Simplifies usage from 2 lines to 1 line

Changes:
- LogStream.h: Add log_stream_.remove(stream_) to LogSinkGuard constructor
- FeatureFinderAlgorithmMetaboIdent.cpp: Remove explicit remove() call
- FeatureFinderIdentificationAlgorithm.cpp: Remove explicit remove() call
- LogStream_test.cpp: Update tests to reflect new RAII behavior

Co-Authored-By: Claude Opus 4.5 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @src/openms/include/OpenMS/CONCEPT/LogStream.h:
- Around line 458-504: LogSinkGuard currently always calls
log_stream_.insert(stream_) in its destructor which can add streams that weren't
present before; change LogSinkGuard to record whether the stream was actually
removed in the constructor (e.g., call log_stream_.remove(stream_) and store the
boolean result in a private removed_ flag) and then only call
log_stream_.insert(stream_) in the destructor if removed_ is true; update the
class members to include the removed_ flag and ensure copy/move semantics remain
deleted.
🧹 Nitpick comments (1)
src/openms/source/FEATUREFINDER/FeatureFindingMetabo.cpp (1)

779-781: Consider using OPENMS_LOG_DEBUG in FFM_DEBUG blocks.

The std::endl → '\n' change is correct. However, these debug blocks use std::cout instead of OPENMS_LOG_DEBUG. While this is pre-existing code and outside the primary scope of this PR, consider refactoring to use the OpenMS logging mechanisms for consistency. Based on learnings, OpenMS logging macros should be used instead of std::cout.

♻️ Optional: Use OPENMS_LOG_DEBUG instead of std::cout
 #ifdef FFM_DEBUG
-          std::cout << "scoring " << candidates[0]->getLabel() << " " << candidates[0]->getCentroidMZ() << 
-            " with " << candidates[mt_idx]->getLabel() << " " << candidates[mt_idx]->getCentroidMZ() << '\n';
+          OPENMS_LOG_DEBUG << "scoring " << candidates[0]->getLabel() << " " << candidates[0]->getCentroidMZ() << 
+            " with " << candidates[mt_idx]->getLabel() << " " << candidates[mt_idx]->getCentroidMZ() << '\n';
 #endif

This pattern could be applied to other FFM_DEBUG blocks at lines 799-802, 842, 938-945, and 969-974.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fcfc540 and 20d0bf7.

📒 Files selected for processing (12)
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
  • src/openms/source/ANALYSIS/ID/PeptideIndexing.cpp
  • src/openms/source/APPLICATIONS/SearchEngineBase.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
  • src/openms/source/FEATUREFINDER/FeatureFindingMetabo.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/topp/FileInfo.cpp
  • src/topp/OpenPepXL.cpp
  • src/topp/PeptideIndexer.cpp
  • src/topp/ProteomicsLFQ.cpp
  • src/topp/XFDR.cpp
🚧 Files skipped from review as they are similar to previous changes (6)
  • src/openms/source/ANALYSIS/ID/PeptideIndexing.cpp
  • src/topp/XFDR.cpp
  • src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
  • src/openms/source/APPLICATIONS/SearchEngineBase.cpp
  • src/topp/ProteomicsLFQ.cpp
  • src/topp/OpenPepXL.cpp
🧰 Additional context used
📓 Path-based instructions (8)
src/openms/**/*.{cpp,h,hpp,cc,cxx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms

Files:

  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
  • src/openms/source/FEATUREFINDER/FeatureFindingMetabo.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
**/*.{h,cpp}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{h,cpp}: Use 2-space indentation for C++ and header files; no tabs; Unix line endings (LF)
All non-template exported classes, structs, functions, and variables must use OPENMS_DLLAPI macro; templates are exempt
One class per file; class name must match file name exactly
Always pair .h header files with .cpp implementation files
Class and type names must use PascalCase; methods must use lowerCamelCase; variables must use snake_case
Private and protected member variables must end with trailing underscore _
Enum names and macro definitions must use UPPER_SNAKE_CASE; prefer enum class over C-style enums
Use OpenMS primitive types from OpenMS/CONCEPT/Types.h instead of standard C++ types
Use Size/SignedSize types for STL .size() values instead of standard integer types
Prefer references over pointers in C++ code
Use Rule-of-0 (no explicit copy/move) or Rule-of-6 (all copy/move/destroy); never use Rule-of-5
Accessor methods must use get/set pairs for protected/private members; do not return references to primitive types
All exceptions must derive from Exception::Base; throw with file, line, and OPENMS_PRETTY_FUNCTION; catch by reference
Code comments must use // style; should comprise at least ~5% of code; describe the next few lines in plain English
Use .clang-format configuration from repository root for code formatting; check with clang-format --dry-run -Werror
Use OpenMS logging macros and OpenMS::LogStream; avoid std::cout and std::cerr
Avoid std::endl; prefer \n for better performance
Prefer OpenMS::String for numeric formatting and parsing
Braces must be on their own lines and aligned; always use braces even for single-line blocks (trivial one-liners may remain single-line)
Space required after keywords (if, for, while) and around binary operators

Files:

  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
  • src/openms/source/FEATUREFINDER/FeatureFindingMetabo.cpp
  • src/topp/PeptideIndexer.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/topp/FileInfo.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
**

📄 CodeRabbit inference engine (AGENTS.md)

File extensions must be lowercase except for ML, XML, and mzData

Files:

  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
  • src/openms/source/FEATUREFINDER/FeatureFindingMetabo.cpp
  • src/topp/PeptideIndexer.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/topp/FileInfo.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
src/topp/*.cpp

📄 CodeRabbit inference engine (AGENTS.md)

src/topp/*.cpp: Use ProgressLogger in TOPP tools for progress reporting
TOPP tool source files must be registered in src/topp/executables.cmake and added to src/openms/source/APPLICATIONS/ToolHandler.cpp
TOPP tools must define parameters in registerOptionsAndFlags_() and read with getStringOption_ and related helpers

Files:

  • src/topp/PeptideIndexer.cpp
  • src/topp/FileInfo.cpp
src/tests/class_tests/openms/**/*.cpp

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Write unit tests for new functionality

Files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
src/tests/class_tests/openms/source/*_test.cpp

📄 CodeRabbit inference engine (AGENTS.md)

src/tests/class_tests/openms/source/*_test.cpp: Unit tests must be placed in src/tests/class_tests/openms/source/ with naming pattern ClassName_test.cpp
Use NEW_TMP_FILE(filename) macro for each output file in tests to avoid side effects
Use FuzzyDiff for numeric comparisons in tests instead of exact equality checks
Use START_SECTION and END_SECTION macros in unit tests; wrap template methods with 2+ arguments in parentheses

Files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
src/openms/include/OpenMS/**/*.h

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Add Doxygen comments for new public methods and classes

Files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
**/*.h

📄 CodeRabbit inference engine (AGENTS.md)

**/*.h: Do not add using namespace or using std::... in header files; allowed only in .cpp files
Prefer forward declarations in headers; include only base class headers, non-pointer members, and templates
Document possible exceptions in Doxygen comments using @throws or @exception tags
Use Doxygen /** */ block comments with @ tags (not backslash \); @brief is required and must be followed by a blank line before details
All parameter documentation in Doxygen must include direction tags: [in], [out], or [in,out]
Use @ingroup and @defgroup Doxygen tags to organize classes and functions into categories
Use @todo tags with assignee name (e.g., @todo JohnDoe fix this) in Doxygen comments
Every .h file must include a file preamble with $Maintainer:$ marker

Files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
🧠 Learnings (22)
📓 Common learnings
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to **/*.{h,cpp} : Use OpenMS logging macros and `OpenMS::LogStream`; avoid `std::cout` and `std::cerr`
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Utilize OpenMS logging mechanisms
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to **/*.{h,cpp} : Use OpenMS logging macros and `OpenMS::LogStream`; avoid `std::cout` and `std::cerr`

Applied to files:

  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
  • src/openms/source/FEATUREFINDER/FeatureFindingMetabo.cpp
  • src/topp/PeptideIndexer.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/topp/FileInfo.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Utilize OpenMS logging mechanisms

Applied to files:

  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
  • src/openms/source/FEATUREFINDER/FeatureFindingMetabo.cpp
  • src/topp/PeptideIndexer.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/topp/FileInfo.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)

Applied to files:

  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Follow the established error handling patterns

Applied to files:

  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/openms/include/OpenMS/CONCEPT/LogStream.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use appropriate OpenMS containers and algorithms

Applied to files:

  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
📚 Learning: 2025-09-24T14:10:28.986Z
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7298
File: src/openms/include/OpenMS/ANALYSIS/ID/IDMergerAlgorithm.h:262-264
Timestamp: 2025-09-24T14:10:28.986Z
Learning: When extracting all elements from an unordered_set using C++17 node handles, use a while(!container.empty()) loop with extract(begin()) rather than iterating with increment, as extraction invalidates iterators.

Applied to files:

  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
📚 Learning: 2025-09-24T14:10:28.986Z
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7298
File: src/openms/include/OpenMS/ANALYSIS/ID/IDMergerAlgorithm.h:262-264
Timestamp: 2025-09-24T14:10:28.986Z
Learning: Never use iterator post-increment with unordered_set::extract() (e.g., extract(it++)) as extract() invalidates the iterator immediately, making the post-incremented iterator invalid. Use while(!empty()) with extract(begin()) instead.

Applied to files:

  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to **/*.{h,cpp} : Avoid `std::endl`; prefer `\n` for better performance

Applied to files:

  • src/openms/source/FEATUREFINDER/FeatureFindingMetabo.cpp
📚 Learning: 2025-08-29T19:09:45.997Z
Learnt from: jcharkow
Repo: OpenMS/OpenMS PR: 8188
File: src/topp/OpenSwathWorkflow.cpp:1118-1123
Timestamp: 2025-08-29T19:09:45.997Z
Learning: In OpenMS OpenSwathWorkflow, the use_ms1_ion_mobility parameter should be respected when applying estimated MS1 ion mobility extraction windows. The apply_window calls for MS1 ion mobility should check both pasef AND use_ms1_ion_mobility to avoid re-enabling disabled functionality.

Applied to files:

  • src/openms/source/FEATUREFINDER/FeatureFindingMetabo.cpp
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/topp/*.cpp : Use `ProgressLogger` in TOPP tools for progress reporting

Applied to files:

  • src/topp/PeptideIndexer.cpp
  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/topp/FileInfo.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/**/*.cpp : Write unit tests for new functionality

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/tests/class_tests/openms/source/*_test.cpp : Use `START_SECTION` and `END_SECTION` macros in unit tests; wrap template methods with 2+ arguments in parentheses

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/tests/class_tests/openms/source/*_test.cpp : Use `NEW_TMP_FILE(filename)` macro for each output file in tests to avoid side effects

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
  • src/topp/FileInfo.cpp
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/tests/class_tests/openms/source/*_test.cpp : Unit tests must be placed in `src/tests/class_tests/openms/source/` with naming pattern `ClassName_test.cpp`

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/*Test.cpp : Follow naming convention: `ClassNameTest.cpp` for `ClassName`

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/tests/class_tests/openms/source/*_test.cpp : Use `FuzzyDiff` for numeric comparisons in tests instead of exact equality checks

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2025-09-03T12:58:20.032Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/tests/topp/CMakeLists.txt:1857-1865
Timestamp: 2025-09-03T12:58:20.032Z
Learning: OpenMS tests: When adding new TOPP tests in src/tests/topp/CMakeLists.txt that compare outputs via FuzzyDiff, always add set_tests_properties("<tool>_<n>_out<m>" PROPERTIES DEPENDS "<tool>_<n>") to avoid flakiness under parallel CTest runs.

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2025-09-16T10:59:20.544Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8208
File: src/openms/source/FORMAT/MzParquetFile.cpp:127-146
Timestamp: 2025-09-16T10:59:20.544Z
Learning: Throwing exceptions from within OpenMP critical sections (#pragma omp critical) can cause undefined behavior and deadlocks because the critical section may not be properly released during exception unwinding. Always avoid throwing exceptions from within OpenMP synchronization constructs.

Applied to files:

  • src/tests/class_tests/openms/source/LogStream_test.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Consider algorithmic complexity for data processing operations

Applied to files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to **/*.{h,cpp} : All non-template exported classes, structs, functions, and variables must use `OPENMS_DLLAPI` macro; templates are exempt

Applied to files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Be mindful of memory usage when processing large datasets

Applied to files:

  • src/openms/include/OpenMS/CONCEPT/LogStream.h
🧬 Code graph analysis (1)
src/openms/include/OpenMS/CONCEPT/LogStream.h (1)
src/openms/source/CONCEPT/LogStream.cpp (25)
  • LogStreamBuf (42-49)
  • LogStreamBuf (51-63)
  • LogStreamBuf (75-88)
  • LogStream (441-450)
  • LogStream (452-461)
  • getThreadLocalLogFatal (634-638)
  • getThreadLocalLogFatal (634-634)
  • getThreadLocalLogError (640-644)
  • getThreadLocalLogError (640-640)
  • getThreadLocalLogWarn (646-650)
  • getThreadLocalLogWarn (646-646)
  • getThreadLocalLogInfo (652-656)
  • getThreadLocalLogInfo (652-652)
  • getThreadLocalLogDebug (658-662)
  • getThreadLocalLogDebug (658-658)
  • getGlobalLogFatal (623-623)
  • getGlobalLogFatal (623-623)
  • getGlobalLogError (624-624)
  • getGlobalLogError (624-624)
  • getGlobalLogWarn (625-625)
  • getGlobalLogWarn (625-625)
  • getGlobalLogInfo (626-626)
  • getGlobalLogInfo (626-626)
  • getGlobalLogDebug (627-627)
  • getGlobalLogDebug (627-627)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: build-and-test (ubuntu-24.04, g++, 13)
  • GitHub Check: build-and-test (windows-2025, cl.exe, 14.44)
  • GitHub Check: build-and-test (macos-14, xcode, 15.4)
  • GitHub Check: build-and-test (ubuntu-24.04, clang++, 17)
  • GitHub Check: build-and-test (ubuntu-24.04-arm, g++, 13)
  • GitHub Check: build-lnx
  • GitHub Check: build-macos-arm
  • GitHub Check: build-win
  • GitHub Check: build-lnx-arm
  • GitHub Check: cppcheck-test
🔇 Additional comments (16)
src/topp/FileInfo.cpp (1)

2200-2212: Correct migration to the new logging API.

The change from OpenMS_Log_info to getGlobalLogInfo() correctly follows the forced migration to the new thread-safe logging infrastructure. Using getGlobalLogInfo() as a sink for the boost filtering_ostream is a valid configuration pattern when no output file is specified.

src/openms/source/FEATUREFINDER/FeatureFindingMetabo.cpp (3)

315-315: LGTM - Warning message uses '\n' as per coding guidelines.

The change from std::endl to '\n' aligns with the coding guidelines for better performance. Note that while the PR description mentions retaining std::endl for warnings requiring immediate output, using '\n' here is acceptable since this warning occurs during parameter initialization, not in a critical error path where immediate flushing is essential.


437-441: Commented debug lines updated consistently.

The std::endl → '\n' changes in commented debug lines are consistent with the coding guidelines. No functional impact since these remain commented out.


852-881: LGTM - Logging statements correctly use OpenMS macros with '\n'.

The warning and info log statements properly use OPENMS_LOG_WARN and OPENMS_LOG_INFO macros with '\n' terminators, aligning with the coding guidelines to avoid std::endl and utilize OpenMS logging mechanisms.

src/openms/include/OpenMS/CONCEPT/LogStream.h (6)

104-114: LGTM! New constructor for thread-local buffer initialization.

The constructor documentation clearly explains its purpose for thread-local logging where each thread copies configuration from global LogStream instances. The @param tags correctly use [in] direction tags as per coding guidelines.


199-201: Protected accessors for stream list look correct.

These accessors provide both const and non-const access to the stream list, which is needed for the new thread-local logging infrastructure.


434-440: New flushIncomplete() method is well-documented.

The Doxygen @brief is present and the description explains the use case for thread-local logging. This aligns with the PR objective of supporting thread-local buffer flushing.


508-520: Thread-local accessor restrictions are well-documented.

The documentation clearly states the important restrictions:

  • Configure logging once at program start before spawning threads
  • OpenMP thread pools reuse threads, so thread_local state persists
  • Do not reconfigure while threads are actively logging

This is critical guidance for users of the new thread-safe logging API.


541-563: Logging macros correctly use thread-local accessors.

The macros now use getThreadLocalLog*() functions, which aligns with the PR objective of providing thread-safe logging. The OPENMS_LOG_FATAL_ERROR and OPENMS_LOG_DEBUG macros appropriately include file/line information.


565-654: Global accessor documentation is comprehensive with appropriate warnings.

The Doxygen documentation for each global accessor clearly:

  1. States these are for configuration purposes only
  2. Warns against direct logging (not thread-safe)
  3. References the appropriate macro to use instead

This aligns with the PR's goal of preventing direct use of global streams for logging while still allowing configuration.

src/topp/PeptideIndexer.cpp (1)

156-156: LGTM! Migration to getGlobalLogDebug() for configuration.

The change from OpenMS_Log_debug to getGlobalLogDebug() aligns with the PR's migration strategy. Using the global accessor here is correct since param.update() is a configuration operation that needs to reference the global stream for suppression purposes, not an actual log output.

src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp (1)

371-373: Verify the intended scope of LogSinkGuard.

The LogSinkGuard is declared without a limited scope block, so cout will remain removed from getGlobalLogInfo() until log_guard goes out of scope at the end of runSingleGroup_() (line 491). This means subsequent OPENMS_LOG_INFO calls (lines 374, 394, 463, 467, etc.) will also not output to cout.

If the intent is to suppress only during pickExperiment(), consider scoping the guard:

♻️ Suggested scoping if narrower suppression is intended
 OPENMS_LOG_INFO << "Detecting chromatographic peaks..." << endl;
-Logger::LogSinkGuard log_guard(getGlobalLogInfo(), cout); // suppress status output from OpenSWATH (exception-safe)
-feat_finder_.pickExperiment(chrom_data_, features, library_,
-                            TransformationDescription(), ms_data_);
+{
+  Logger::LogSinkGuard log_guard(getGlobalLogInfo(), cout); // suppress status output from OpenSWATH (exception-safe)
+  feat_finder_.pickExperiment(chrom_data_, features, library_,
+                              TransformationDescription(), ms_data_);
+}
src/tests/class_tests/openms/source/LogStream_test.cpp (4)

55-101: LGTM! Thread-local logging tests are pragmatic.

The tests correctly acknowledge that thread-local streams copy stream_list_ at initialization, so adding a capture stream after thread creation won't affect thread-local loggers. The tests appropriately verify that:

  1. Basic parallel logging doesn't crash (Test 1)
  2. High-volume stress testing with buffer-length strings works (Test 2)

The "if we get here without crashing, the test passes" approach is reasonable for concurrency testing where verifying exact output would be complex.


203-262: Comprehensive LogSinkGuard test coverage.

The test section covers three important scenarios:

  1. Normal scope exit (lines 206-221): Verifies remove-on-construction and insert-on-destruction
  2. Exception safety (lines 224-242): Confirms stream is re-inserted even when exception is thrown
  3. Nested guards (lines 245-260): Tests multiple guards on the same stream

One observation: In Test 3 (nested guards), guard2 removes an already-removed stream, and guard1 re-inserts an already-present stream. The test expects "once_reinserted\nfinal\n" which validates the behavior. This confirms insert() and remove() are idempotent, which is good.


448-473: Macro test pattern is correct for thread-local streams.

The test correctly:

  1. Calls clearCache() before inserting the test stream (as noted in comments)
  2. Uses removeAllStreams() to ensure a clean state
  3. Inserts the test stream into the thread-local logger
  4. Removes the test stream after testing

This pattern ensures test isolation and prevents interference with default streams.


476-567: Remaining macro tests follow consistent pattern.

All macro tests (OPENMS_LOG_ERROR, OPENMS_LOG_WARN, OPENMS_LOG_INFO, OPENMS_LOG_DEBUG) follow the same correct pattern:

  1. clearCache() before test stream insertion
  2. removeAllStreams() for clean state
  3. insert() test stream
  4. Perform logging
  5. remove() test stream

The tests properly validate output against expected files or regex patterns.

@timosachsenberg
timosachsenberg merged commit 9f29fa6 into develop Jan 12, 2026
@timosachsenberg
timosachsenberg deleted the logger_segfault branch January 12, 2026 21:02
timosachsenberg added a commit that referenced this pull request Jun 16, 2026
#9515)

OPENMS_LOG_* routes through thread-local LogStream/LogStreamBuf instances,
but three shared resources survived the thread-local refactor (#8620/#8596)
and corrupt the heap when logging from OpenMP parallel regions (0xC0000374
on Windows; hit in practice by the imzML reader in #9454):

1. syncLF_() assembled lines through a function-local
   `static char buf[BUFFER_LENGTH]` shared across every thread. Replaced
   with direct std::string::append into incomplete_line_/outstring, so there
   is no scratch buffer (and no out-of-bounds read when a racing thread
   overwrites the trailing NUL).

2. distribute_() wrote to the shared sink (std::cerr/std::cout) and mutated
   the shared global Colorizer (yellow/red/magenta -- its std::stringstream
   and flags) from multiple threads without synchronization. Both are now
   serialized by a single global std::mutex held around the whole
   distribute_() body. The mutex is intentionally leaked so it stays valid
   during static teardown (a std::mutex, unlike the former OpenMP critical
   section, does not depend on the OpenMP runtime). Notifier callbacks run
   after the lock is released to avoid self-deadlock.

3. expandPrefix_() used non-reentrant std::localtime (shared static tm).
   Replaced with localtime_r/localtime_s.

Also corrects the stale LogStream.h note that claimed the macros are
protected by OPENMS_THREAD_CRITICAL (they are not -- safety comes from
thread-local buffers plus the new sink mutex), and adds a regression test
that logs 5000 unique messages from an 8-thread OpenMP region and asserts
each arrives exactly once and intact.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
timosachsenberg added a commit that referenced this pull request Jun 16, 2026
#9515)

OPENMS_LOG_* routes through thread-local LogStream/LogStreamBuf instances,
but three shared resources survived the thread-local refactor (#8620/#8596)
and corrupt the heap when logging from OpenMP parallel regions (0xC0000374
on Windows; hit in practice by the imzML reader in #9454):

1. syncLF_() assembled lines through a function-local
   `static char buf[BUFFER_LENGTH]` shared across every thread. Replaced
   with direct std::string::append into incomplete_line_/outstring, so there
   is no scratch buffer (and no out-of-bounds read when a racing thread
   overwrites the trailing NUL).

2. distribute_() wrote to the shared sink (std::cerr/std::cout) and mutated
   the shared global Colorizer (yellow/red/magenta -- its std::stringstream
   and flags) from multiple threads without synchronization. Both are now
   serialized by a single global std::mutex held around the whole
   distribute_() body. The mutex is intentionally leaked so it stays valid
   during static teardown (a std::mutex, unlike the former OpenMP critical
   section, does not depend on the OpenMP runtime). Notifier callbacks run
   after the lock is released to avoid self-deadlock.

3. expandPrefix_() used non-reentrant std::localtime (shared static tm).
   Replaced with localtime_r/localtime_s.

Also corrects the stale LogStream.h note that claimed the macros are
protected by OPENMS_THREAD_CRITICAL (they are not -- safety comes from
thread-local buffers plus the new sink mutex), and adds a regression test
that logs 5000 unique messages from an 8-thread OpenMP region and asserts
each arrives exactly once and intact.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
timosachsenberg added a commit that referenced this pull request Jun 17, 2026
#9515) (#9583)

OPENMS_LOG_* routes through thread-local LogStream/LogStreamBuf instances,
but three shared resources survived the thread-local refactor (#8620/#8596)
and corrupt the heap when logging from OpenMP parallel regions (0xC0000374
on Windows; hit in practice by the imzML reader in #9454):

1. syncLF_() assembled lines through a function-local
   `static char buf[BUFFER_LENGTH]` shared across every thread. Replaced
   with direct std::string::append into incomplete_line_/outstring, so there
   is no scratch buffer (and no out-of-bounds read when a racing thread
   overwrites the trailing NUL).

2. distribute_() wrote to the shared sink (std::cerr/std::cout) and mutated
   the shared global Colorizer (yellow/red/magenta -- its std::stringstream
   and flags) from multiple threads without synchronization. Both are now
   serialized by a single global std::mutex held around the whole
   distribute_() body. The mutex is intentionally leaked so it stays valid
   during static teardown (a std::mutex, unlike the former OpenMP critical
   section, does not depend on the OpenMP runtime). Notifier callbacks run
   after the lock is released to avoid self-deadlock.

3. expandPrefix_() used non-reentrant std::localtime (shared static tm).
   Replaced with localtime_r/localtime_s.

Also corrects the stale LogStream.h note that claimed the macros are
protected by OPENMS_THREAD_CRITICAL (they are not -- safety comes from
thread-local buffers plus the new sink mutex), and adds a regression test
that logs 5000 unique messages from an 8-thread OpenMP region and asserts
each arrives exactly once and intact.

Co-authored-by: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants