Repository navigation
Replace Qt headers with STL/Boost equivalents - #8840
Conversation
Replace 9 Qt header includes across 8 files with standard C++/Boost alternatives to reduce Qt coupling: - QRegularExpression → std::regex (MascotGenericFile, InspectOutfile) - QFile + QTextStream → std::ifstream (3 CHEMISTRY data providers) - QCryptographicHash + QFile → self-contained SHA1 + std::ifstream (FileHandler) - Remove dead includes: QDebug (File.cpp), QDir (MultiplexClustering.cpp) Co-Authored-By: Claude Opus 4.6 <[email protected]>
📝 WalkthroughWalkthroughThis PR systematically removes Qt framework dependencies across OpenMS core modules by replacing Qt-based I/O, regex, and hashing implementations with C++ standard library equivalents (std::ifstream, std::regex, and a custom SHA-1 implementation). Changes span file reading, JSON parsing, data validation, and cryptographic hashing while maintaining existing error handling and behavior. Changes
Possibly related issues
Possibly related PRs
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)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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.
🧹 Nitpick comments (1)
src/openms/source/FORMAT/FileHandler.cpp (1)
680-684: Consider logging or throwing on file-open failure instead of silent empty return.Returning an empty string when the file cannot be opened fails silently. Downstream callers like
MzQCFile.cpp(line 237) embed this hash directly into JSON output. An empty hash could corrupt metadata without any warning.Consider logging an error or throwing an exception for consistency with the project's error handling patterns.
♻️ Suggested improvement
std::ifstream file(filename, std::ios::binary); if (!file.is_open()) { - return ""; + OPENMS_LOG_ERROR << "Failed to open file for hashing: " << filename << "\n"; + return ""; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/FORMAT/FileHandler.cpp` around lines 680 - 684, The code that opens the file (the std::ifstream file(filename, std::ios::binary) block in FileHandler.cpp) currently returns an empty string on failure; instead, either log an error or throw an exception so failures are not silent — replace the "return \"\"" with a clear failure path such as throwing std::runtime_error(fmt::format("Failed to open file for hashing: {}", filename)) or calling the project's error logger with the filename and reason, so callers (e.g., the code that embeds this hash in MzQCFile) receive an explicit error rather than an empty hash.
🤖 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/FORMAT/FileHandler.cpp`:
- Around line 680-684: The code that opens the file (the std::ifstream
file(filename, std::ios::binary) block in FileHandler.cpp) currently returns an
empty string on failure; instead, either log an error or throw an exception so
failures are not silent — replace the "return \"\"" with a clear failure path
such as throwing std::runtime_error(fmt::format("Failed to open file for
hashing: {}", filename)) or calling the project's error logger with the filename
and reason, so callers (e.g., the code that embeds this hash in MzQCFile)
receive an explicit error rather than an empty hash.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 349122f0-505a-41e1-b034-4ad6c6ab38c6
📒 Files selected for processing (8)
src/openms/source/CHEMISTRY/ModomicsJSONDataProvider.cppsrc/openms/source/CHEMISTRY/MonosaccharideDB.cppsrc/openms/source/CHEMISTRY/RibonucleotideTSVDataProvider.cppsrc/openms/source/FEATUREFINDER/MultiplexClustering.cppsrc/openms/source/FORMAT/FileHandler.cppsrc/openms/source/FORMAT/InspectOutfile.cppsrc/openms/source/FORMAT/MascotGenericFile.cppsrc/openms/source/SYSTEM/File.cpp
💤 Files with no reviewable changes (2)
- src/openms/source/FEATUREFINDER/MultiplexClustering.cpp
- src/openms/source/SYSTEM/File.cpp
Summary
QRegularExpressionwithstd::regexinMascotGenericFile.cppandInspectOutfile.cppQFile+QTextStreamwithstd::ifstreamin 3 CHEMISTRY data providers (RibonucleotideTSVDataProvider,ModomicsJSONDataProvider,MonosaccharideDB)QCryptographicHash+QFilewith a self-contained SHA1 implementation (RFC 3174) +std::ifstreaminFileHandler.cppQDebugfromFile.cpp,QDirfromMultiplexClustering.cppTotal: 9 Qt header includes removed across 8 files.
Test plan
DimMapper_testpassesRibonucleotideDB_testpasses (covers TSV + JSON data providers)InspectOutfile_testpassesMascotGenericFile_testpassesMultiplexClustering_testpassesFileHandler_testSHA1 hash matches expected valued50d5144cc3805749b9e8d16f3bc8994979d8142🤖 Generated with Claude Code
Summary by CodeRabbit