Repository navigation
IDMapper: prevent duplicate spectrum reference insertion - #8905
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughModified spectrum reference handling in IDMapper.cpp to preserve the first entry and warn on duplicates instead of silently overwriting. Direct assignment was replaced with insertion into the inner map, logging a warning when a duplicate key is encountered while preserving existing control flow. Changes
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment Tip CodeRabbit can generate a title for your PR based on the changes.Add |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/openms/source/ANALYSIS/ID/IDMapper.cpp (1)
362-364: Replacestd::endlwith"\n"in this warning path.At Line 363,
std::endlforces a flush each time; prefer"\n"to avoid unnecessary overhead.Proposed change
- OPENMS_LOG_WARN << "Duplicate spectrum reference detected: " - << spectrum_reference << std::endl; + OPENMS_LOG_WARN << "Duplicate spectrum reference detected: " + << spectrum_reference << "\n";As per coding guidelines "
**/*.{h,cpp}: Avoidstd::endlfor performance; prefer\n."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/ANALYSIS/ID/IDMapper.cpp` around lines 362 - 364, Replace the use of std::endl in the duplicate-spectrum warning so it doesn't flush the stream each time: in the block that logs "Duplicate spectrum reference detected: " (use the OPENMS_LOG_WARN call that prints spectrum_reference in IDMapper.cpp) change the trailing std::endl to a plain "\n" character to avoid unnecessary flushes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/openms/source/ANALYSIS/ID/IDMapper.cpp`:
- Around line 362-364: Replace the use of std::endl in the duplicate-spectrum
warning so it doesn't flush the stream each time: in the block that logs
"Duplicate spectrum reference detected: " (use the OPENMS_LOG_WARN call that
prints spectrum_reference in IDMapper.cpp) change the trailing std::endl to a
plain "\n" character to avoid unnecessary flushes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: aa2c4ede-66ea-4a7c-9247-b588e6e05b73
📒 Files selected for processing (1)
src/openms/source/ANALYSIS/ID/IDMapper.cpp
|
Thanks. Please prefer \n instead of newline for warnings. |
|
Thanks for the review! |
|
Hi, this PR has been approved, but I noticed one CI test is getting cancelled after running for several hours. Could you please advise if this is expected or if anything needs to be fixed before merging? |
|
@timosachsenberg maybe some cache eviction for windows happened recently? |
|
Hi, just following up here since I haven’t heard back yet. @timosachsenberg As this PR is already approved, should I wait for confirmation on the CI issue or is it okay to merge? |
|
Thanks for the reviews and guidance! Merged — we can keep an eye on the CI issue separately if needed. |
Description
This PR fixes a TODO in
IDMapper.cppby preventing duplicate spectrum references from overwriting existing entries infile2nativeid2pepid.Previously, the code inserted entries using direct assignment, which could silently overwrite an existing mapping if the same spectrum reference appeared multiple times. This change replaces the assignment with
insert()and logs a warning when a duplicate spectrum reference is detected.The change improves robustness while preserving the original mapping behavior for valid inputs.
Summary by CodeRabbit