Skip to content

fix: low-hanging code quality fixes across the codebase - #8760

Merged
timosachsenberg merged 2 commits into
developfrom
fix/low-hanging-code-quality-fixes
Feb 13, 2026
Merged

timosachsenberg merged 2 commits into
developfrom
fix/low-hanging-code-quality-fixes

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Feb 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Bug fix: Add missing identifier = assignment in InspectOutfile.cpp:117 (expression result was discarded)
  • Dead code removal: Remove unreachable duplicate column check in InspectOutfile.cpp, dead #if 0 block in FlagSet.cpp, commented-out .h entries in DATASTRUCTURES sources.cmake
  • Include guard fix: Replace #ifndef/#define/#endif with #pragma once in GridBasedCluster.h and move it before #include directives (consistent with rest of codebase)
  • Readability: Fix comma-operator abuse in Param.cpp :type suffix check
  • Logging: Replace std::cerr with OPENMS_LOG_WARN in SignalToNoiseEstimatorMeanIterative.h and SignalToNoiseEstimatorMedian.h
  • sources.cmake gaps: Add 8 missing headers (ParamCWLFile.h, ParamJSONFile.h, ConsensusXMLHandler.h, FeatureXMLHandler.h, MatrixEigen.h, StringConversions.h, FeatureFinderAlgorithm.h, FeatureFinderDefs.h)
  • sources.cmake duplicates: Remove duplicate MSDataTransformingConsumer.cpp and MSDataWritingConsumer.cpp entries in DATAACCESS sources.cmake
  • Formatting: Fix indentation of MassExplainer.cpp in DATASTRUCTURES sources.cmake

Test plan

  • CMake reconfigure succeeds
  • Full build completes (exit code 0)
  • InspectOutfile_test passes
  • Param_test passes
  • GridBasedCluster_test and GridBasedClustering_test pass
  • SignalToNoiseEstimatorMeanIterative_test and SignalToNoiseEstimatorMedian_test pass
  • FlagSet_test passes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved consistency of warning/error logging across processing modules
    • Fixed parameter-handling control flow to avoid unintended side effects
    • Enhanced file identification in processing workflows
  • Refactor

    • Standardized header-guard mechanism for improved build consistency
  • Chores

    • Expanded and adjusted public header list in build configuration
    • Removed certain now-unneeded source components from the build configuration

- Fix missing `identifier =` assignment in InspectOutfile.cpp (bug)
- Remove unreachable duplicate column check in InspectOutfile.cpp
- Replace #ifndef/#define/#endif with #pragma once in GridBasedCluster.h
  and move it before includes
- Fix comma-operator abuse in Param.cpp `:type` suffix check
- Replace std::cerr with OPENMS_LOG_WARN in SignalToNoiseEstimator
  headers (MeanIterative and Median)
- Clean up dead #if 0 block in FlagSet.cpp (header-only class)
- Add missing headers to sources.cmake (FORMAT, HANDLERS,
  DATASTRUCTURES, FEATUREFINDER)
- Remove duplicate entries in FORMAT/DATAACCESS sources.cmake
- Remove commented-out .h entries and fix indentation in
  DATASTRUCTURES sources.cmake

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

coderabbitai Bot commented Feb 13, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR updates CMake header/source lists (adds and removes public headers/sources), replaces std::cerr warnings with OPENMS logging in noise estimators, switches one header to #pragma once, simplifies a header-only source file, and refactors small control-flow and parsing checks in Param.cpp and InspectOutfile.cpp.

Changes

Cohort / File(s) Summary
CMake: added public headers
src/openms/include/OpenMS/DATASTRUCTURES/sources.cmake, src/openms/include/OpenMS/FEATUREFINDER/sources.cmake, src/openms/include/OpenMS/FORMAT/HANDLERS/sources.cmake, src/openms/include/OpenMS/FORMAT/sources.cmake
Added new headers to public/header lists: MatrixEigen.h, StringConversions.h, FeatureFinderAlgorithm.h, FeatureFinderDefs.h, ConsensusXMLHandler.h, FeatureXMLHandler.h, ParamCWLFile.h, ParamJSONFile.h.
CMake: removed/adjusted sources/headers
src/openms/source/DATASTRUCTURES/sources.cmake, src/openms/source/FORMAT/DATAACCESS/sources.cmake
Removed IsotopeCluster.h, KDTree.h from DATASTRUCTURES header list; removed MSDataTransformingConsumer.cpp and MSDataWritingConsumer.cpp from FORMAT/DATAACCESS sources; minor whitespace reformatting.
Header guard modernization
src/openms/include/OpenMS/ML/CLUSTERING/GridBasedCluster.h
Replaced traditional include-guard macros with #pragma once.
Logging updates
src/openms/include/OpenMS/PROCESSING/NOISEESTIMATION/SignalToNoiseEstimatorMeanIterative.h, src/openms/include/OpenMS/PROCESSING/NOISEESTIMATION/SignalToNoiseEstimatorMedian.h
Replaced direct std::cerr warnings with OPENMS_LOG_WARN (added LogStream include in MeanIterative).
Code refactors / small logic changes
src/openms/source/DATASTRUCTURES/FlagSet.cpp, src/openms/source/DATASTRUCTURES/Param.cpp, src/openms/source/FORMAT/InspectOutfile.cpp
Converted FlagSet.cpp to a header-only placeholder comment; moved an assignment out of an if condition in Param.cpp (preserves behavior, avoids in-condition assignment); in InspectOutfile.cpp set identifier when search engine present and removed duplicate/obsolete column-count validation blocks.

Possibly related PRs

  • Add doc #8044: Touches IsotopeCluster.h while this PR removes IsotopeCluster.h from DATASTRUCTURES public headers — related at the header exposure/configuration level.
  • OPENMS_LOG_WARN writes to std::cerr now #8754: Alters logging behavior underlying OPENMS_LOG_WARN; related because this PR replaces std::cerr uses with OPENMS_LOG_WARN.

Suggested reviewers

  • jpfeuffer
  • cbielow

Poem

🐇 I hopped through CMake, added headers bright,
Swapped plain cerr for OPENMS light,
Guards made terse with pragma's cheer,
Tiny fixes stitched up near,
Code and build now hum tonight. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (13 files):

⚔️ CHANGELOG (content)
⚔️ src/openms/include/OpenMS/DATASTRUCTURES/sources.cmake (content)
⚔️ src/openms/include/OpenMS/FEATUREFINDER/sources.cmake (content)
⚔️ src/openms/include/OpenMS/FORMAT/HANDLERS/sources.cmake (content)
⚔️ src/openms/include/OpenMS/FORMAT/sources.cmake (content)
⚔️ src/openms/include/OpenMS/ML/CLUSTERING/GridBasedCluster.h (content)
⚔️ src/openms/include/OpenMS/PROCESSING/NOISEESTIMATION/SignalToNoiseEstimatorMeanIterative.h (content)
⚔️ src/openms/include/OpenMS/PROCESSING/NOISEESTIMATION/SignalToNoiseEstimatorMedian.h (content)
⚔️ src/openms/source/DATASTRUCTURES/FlagSet.cpp (content)
⚔️ src/openms/source/DATASTRUCTURES/Param.cpp (content)
⚔️ src/openms/source/DATASTRUCTURES/sources.cmake (content)
⚔️ src/openms/source/FORMAT/DATAACCESS/sources.cmake (content)
⚔️ src/openms/source/FORMAT/InspectOutfile.cpp (content)

These conflicts must be resolved before merging into develop.
Resolve conflicts locally and push changes to this branch.
✅ 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 'fix: low-hanging code quality fixes across the codebase' accurately summarizes the PR's main objective of applying multiple small code-quality and correctness improvements across the codebase.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/low-hanging-code-quality-fixes
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch fix/low-hanging-code-quality-fixes
  • Create stacked PR with resolved conflicts
  • Post resolved changes as copyable diffs in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
src/openms/include/OpenMS/PROCESSING/NOISEESTIMATION/SignalToNoiseEstimatorMeanIterative.h (1)

222-222: Nit: prefer "\n" over std::endl.

Both logging statements still use std::endl. The coding guidelines state to "Avoid std::endl; prefer \n for better performance in logging and output operations." This is a very minor point—OPENMS_LOG_WARN may flush differently anyway—but worth noting for consistency. As per coding guidelines: "Avoid std::endl; prefer \n for better performance in logging and output operations."

Suggested diff
-        OPENMS_LOG_WARN << "SignalToNoiseEstimatorMeanIterative: the max_intensity_ value should be positive! " << max_intensity_ << std::endl;
+        OPENMS_LOG_WARN << "SignalToNoiseEstimatorMeanIterative: the max_intensity_ value should be positive! " << max_intensity_ << "\n";
                         << " If it is too low, then too many high intensity peaks will be discarded, which leads to a sparse window!"
-                        << std::endl;
+                        << "\n";

Also applies to: 358-358


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: 1

🤖 Fix all issues with AI agents
In
`@src/openms/include/OpenMS/PROCESSING/NOISEESTIMATION/SignalToNoiseEstimatorMeanIterative.h`:
- Line 222: In SignalToNoiseEstimatorMeanIterative (the class in
SignalToNoiseEstimatorMeanIterative.h) replace the remaining std::cerr-based
sparse-window warning (the block around lines 353–358) with the OpenMS logging
macro OPENMS_LOG_WARN so it matches the earlier change and
SignalToNoiseEstimatorMedian; keep the original warning text and any variables
referenced (e.g. window size / sparse count) but send them to OPENMS_LOG_WARN <<
... << std::endl; LogStream is already included so no additional includes are
necessary.
🧹 Nitpick comments (1)
src/openms/include/OpenMS/FEATUREFINDER/sources.cmake (1)

18-20: Consider reordering FeatureFinderDefs.h for alphabetical consistency.

FeatureFinderDefs.h should be placed after FeatureFinderAlgorithmPickedHelperStructs.h to maintain alphabetical order. The file already has ordering inconsistencies elsewhere, so this is optional.

…stimatorMeanIterative

Address CodeRabbit review feedback: the sparse-window warning on line 353
also used std::cerr instead of OPENMS_LOG_WARN.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@timosachsenberg
timosachsenberg merged commit 7e91e1d into develop Feb 13, 2026
41 checks passed
@timosachsenberg
timosachsenberg deleted the fix/low-hanging-code-quality-fixes branch February 13, 2026 14:37
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.

1 participant