Repository navigation
Migrate plain enums to enum class - #8622
Conversation
This commit fixes all test file compilation errors introduced by the enum class migration (commit 66cee84). The changes address two main issues: 1. Array indexing with enum class values now requires static_cast<size_t>() 2. Unscoped enum references updated to use proper EnumClass::VALUE syntax
- Add missing enum class prefixes for SIZE_OF_* constants in helper functions (MassAnalyzer, Sample, InstrumentSettings, DataProcessing, SpectrumSettings) - Fix type mismatch in RangeUtils.h: compare Polarity enum directly instead of casting to Int - Add wrap-attach annotation to ChecksumType in SourceFile.pxd for proper pyOpenMS wrapper generation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Convert plain enums to enum class for type safety - Add SIZE_OF_* sentinel values - Update all usages to use scoped enum syntax - Expose both enum classes in pyOpenMS via BuildInfo.pxd 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Update code to use proper enum class syntax after enum migration: - GUI visualizers: Add static_cast for array indexing and setCurrentIndex - C++ tests: Use fully qualified enum names (e.g., Class::EnumType::VALUE) - pyOpenMS tests: Update enum references (Type_IonDetector -> Type, MZTrafoModel_MODELTYPE -> MZTrafoModel.MODELTYPE, etc.) Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
Important Review skippedToo many files! 11 files out of 161 files are above the max files limit of 150. You can disable this status message by setting the 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 |
There was a problem hiding this comment.
Pull request overview
This PR migrates plain enums to scoped enum classes (C++11 feature) across the OpenMS codebase for improved type safety. The migration includes several enum types such as Sample::SampleState, SpectrumSettings::SpectrumType, ProteinIdentification::PeakMassType, MassAnalyzer enums, and many others. All usages have been updated across C++ source files, tests, GUI visualizers, and pyOpenMS bindings with proper scoping (e.g., ClassName::EnumType::VALUE) and static_cast conversions where needed for array indexing and Qt widget operations.
Reviewed changes
Copilot reviewed 162 out of 162 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/topp/*.cpp | Updated enum comparisons and assignments to use scoped enum class syntax |
| src/tests/topp/*.csv | Added new test data file for OpenNuXL |
| src/tests/class_tests/openms/source/*.cpp | Updated test assertions to use enum class scoping and static_cast for array indexing |
| src/pyOpenMS/pxds/*.pxd | Changed enum declarations to cdef enum class with proper wrap-attach directives |
| src/pyOpenMS/tests/unittests/*.py | Updated Python tests to use nested enum naming convention (e.g., Class.EnumType.VALUE) |
| src/openms_gui/source/VISUAL/*.cpp | Added static_cast conversions for Qt widget methods and array indexing |
| src/openms/source/**/*.cpp | Updated enum initializations, switch cases, comparisons, and array indexing throughout |
|
yolo |
Summary
Sample::SampleState,OpenMS_OS,OpenMS_Architecture, and various other enumsstatic_castfor array indexing and Qt widget methodsTest plan
🤖 Generated with Claude Code