Skip to content

refactor: remove Qt dependency from TOPP tools - #9041

Merged
timosachsenberg merged 26 commits into
developfrom
feature/remove-qt-from-topp
Mar 31, 2026
Merged

timosachsenberg merged 26 commits into
developfrom
feature/remove-qt-from-topp

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Mar 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Make src/topp/ 100% Qt-free and improve the File API.

Phase 1: Remove Qt6::Core from 11 TOPP tools

Replace Qt usage with std::filesystem, std::regex, and existing OpenMS utilities (File, ExternalProcess, Base64::encodeStrings):

Tool Qt removed Replacement
Resampler dead GUI include (removed, ungated from WITH_GUI)
MzMLSplitter QFile::size() File::fileSize()
QCExtractor, QCShrinker QFileInfo::baseName() File::stemName()
QCEmbedder QFile::readAll(), QByteArray::toBase64() std::ifstream, Base64::encodeStrings()
IDRipper QFileInfo, QDir std::filesystem::path, File::absolutePath()
OpenSwathFileSplitter QDir, QFileInfo::baseName() File::absolutePath(), File::stemName()
OpenSwathWorkflow QDir File::absolutePath()
AssayGeneratorMetaboSirius QDirIterator File::listDirectories()
CometAdapter QRegularExpression std::regex
MetaProSIP QProcess, QFile, QDir, QString ExternalProcess, File, File::makeDir()

Phase 2: Move 3 GUI tools to src/openms_gui/

  • ExecutePipeline, INIUpdater, ImageCreator moved to src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/
  • Removed TOPP_executables_with_GUIlib concept entirely
  • Tools remain in TOPP_TOOLS for CWL/INI generation

CMake cleanup

  • Moved find_package(Qt6 Core) inside WITH_GUI block
  • Guarded KNIME Qt6::qmake usage with if(TARGET Qt6::qmake)
  • Fixed add_subdirectory order: topp before openms_gui so TOPP_TOOLS cache initializes correctly

New File API methods

  • File::stemName(path) — basename without known extensions (sample.mzML.gz -> sample). Replaces the FileHandler::stripExtension(File::basename()) pattern (17 TOPP sites, 32 codebase-wide).
  • File::extension(path) — compound-aware extension extraction (.mzML.gz). Satisfies stemName(f) + extension(f) == basename(f).
  • File::listDirectories(dir) — sorted list of subdirectory absolute paths, no-throw, follows fileList() pattern. All 3 have unit tests.

Test plan

  • Full build succeeds with WITH_GUI=ON (100%)
  • ctest passes (2495/2505, all 10 failures pre-existing)
  • Resampler tests pass without WITH_GUI gate (4/4)
  • All refactored TOPP tool tests pass (207/207)
  • New File unit tests pass (stemName, extension, listDirectories)
  • Zero Qt references in src/topp/
  • Verify WITH_GUI=OFF build (CI)
  • Verify CWL generation includes moved tools (CI)

Summary by CodeRabbit

Release Notes

  • New Features

    • TOPP tools can now build without GUI dependencies, enabling lighter standalone builds.
    • Added new file utility APIs for filename/extension handling and directory listing.
  • Refactoring

    • TOPP tools now use standard C++ libraries and OpenMS utilities for cross-platform consistency.
    • Improved build system separation of GUI and command-line tool components.
  • Tests

    • Resampler tests now execute in all build configurations, improving test coverage.

timosachsenberg and others added 18 commits March 30, 2026 15:46
Covers two-phase approach: replace Qt6::Core usage with std/OpenMS
utilities in 11 tools, then move 3 GUI-entangled tools to openms_gui.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
13 tasks covering Phase 1 (replace Qt6::Core in 11 tools) and Phase 2
(move 3 GUI tools to openms_gui, clean up CMake).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Remove unused #include <OpenMS/VISUAL/MultiGradient.h> from Resampler.cpp,
move Resampler from TOPP_executables_with_GUIlib to TOPP_executables,
remove it from the ToolHandler GUI_tools exclusion list, and drop the
WITH_GUI guard around its TOPP test definitions.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…FileHandler::stripExtension()

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
… Base64

Remove Qt includes (QByteArray, QFile, QString, QFileInfo) and replace with
OpenMS FileHandler/Base64 and std::ifstream/ostringstream for file reading
and base64 encoding. Use FileHandler::stripExtension + File::basename for
compound-extension-aware basename extraction.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…filesystem::directory_iterator

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Replace QDir::absolutePath() and QFileInfo::baseName() usage in
OpenSwathFileSplitter and OpenSwathWorkflow with OpenMS-native
File::absolutePath() and FileHandler::stripExtension(File::basename()),
removing the Qt dependency from both TOPP tools.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Remove Qt dependency on QRegularExpression, replacing it with std::regex
and std::remove for space stripping as part of Qt removal from TOPP tools.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…s and File utilities

Replace all Qt dependencies in MetaProSIP.cpp:
- Remove QtCore includes (QStringList, QFile, QDir, QFileInfo, QProcess)
- Add ExternalProcess, filesystem includes
- Add runRScript() helper to consolidate 5 near-identical QProcess blocks
- Replace QProcess R execution with ExternalProcess::run() calls
- Replace QFile::copy/remove with File::copy/remove
- Replace QDir with File::absolutePath and std::filesystem::create_directories
- Replace QFileInfo::baseName with FileHandler::stripExtension(File::basename())
- Change QString function parameters to const String&

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Move 3 TOPP tools that depend on OpenMS_GUI into the GUI library
directory, making src/topp/ 100% Qt-free. Update CMake registration
so the tools are built as part of the GUI executables, remain in the
TOPP_TOOLS list for CWL/INI generation, and are dependencies of the
TOPP collection target.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Qt is no longer needed by any non-GUI component. Guard KNIME
packaging against missing Qt targets.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Base64::encode is designed for floating-point arrays, not raw bytes.
Use encodeStrings instead which handles arbitrary binary data correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…le_size

OpenMS::String does not implicitly convert to std::filesystem::path.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Adds stemName(), extension(), listDirectories() to OpenMS::File
and replaces awkward patterns in TOPP tools.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Mar 30, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Gate Qt discovery/use to GUI builds; add File::stemName/extension/listDirectories; replace Qt types/APIs across many TOPP tools with std::filesystem/OpenMS utilities and ExternalProcess; move select GUI executables into GUI wiring; update tests and CMake ordering to support Qt‑free TOPP builds.

Changes

Cohort / File(s) Summary
CMake Qt/qmake Conditional Handling
cmake/cmake_findExternalLibs.cmake, cmake/knime_package_support.cmake
Find-package for Qt6::Core is executed only when WITH_GUI is enabled (FATAL if missing with GUI); qmake probing guarded by if(TARGET Qt6::qmake) to avoid unconditional qmake queries.
TOPP executable lists & CMake wiring
src/topp/executables.cmake, src/topp/CMakeLists.txt, src/openms_gui/CMakeLists.txt, src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/executables.cmake, src/openms/source/APPLICATIONS/ToolHandler.cpp
Removed TOPP_executables_with_GUIlib; moved Resampler into main TOPP list; added GUI executables (ExecutePipeline,ImageCreator,INIUpdater) in GUI-side CMake and stop erasing Resampler for non‑GUI builds.
Tests: Resampler gating removal
src/tests/topp/CMakeLists.txt
Removed if(WITH_GUI) guard so Resampler CTests are registered unconditionally.
File API additions & tests
src/openms/include/OpenMS/SYSTEM/File.h, src/openms/source/SYSTEM/File.cpp, src/tests/class_tests/openms/source/File_test.cpp, docs/superpowers/plans/2026-03-30-file-api-improvements.md
Add File::stemName, File::extension, File::listDirectories with implementations and unit tests; update callers in TOPP tools to use these helpers.
Std/OpenMS replacements in TOPP tools
src/topp/... (AssayGeneratorMetaboSirius.cpp, IDRipper.cpp, MzMLSplitter.cpp, OpenSwathFileSplitter.cpp, OpenSwathWorkflow.cpp, ProteomicsLFQ.cpp, ProteinQuantifier.cpp, SpectraSTSearchAdapter.cpp, ConsensusID.cpp, MascotAdapterOnline.cpp, etc.)
Replace Qt filesystem/string utilities with OpenMS::File/std::filesystem helpers (stem/extract, listDirs, fileSize); update path normalization and file operations accordingly.
Regex and parsing replacements
src/topp/CometAdapter.cpp
Replace QRegularExpression with std::regex, strip spaces before matching, and parse captures with std::stoi.
Process execution & R integration refactor
src/topp/MetaProSIP.cpp
Introduce runRScript(...) using OpenMS::ExternalProcess to invoke R (captures merged stdout+stderr), replace QProcess use, switch Qt QString API params to OpenMS String, and use File utilities for temp/file handling.
Binary I/O & base64 refactor
src/topp/QCEmbedder.cpp
Replace QFile/QByteArray base64 logic with std::ifstream and Base64::encodeStrings, only encode if stream opens.
Minor Qt include cleanup
src/topp/QCExporter.cpp, src/topp/QCImporter.cpp, src/topp/QCMerger.cpp, src/topp/QCShrinker.cpp, src/topp/Resampler.cpp
Remove commented Qt includes and an unnecessary GUI include; add/adjust OpenMS/SYSTEM/File.h includes where used.
Docs: removal/migration plan & design
docs/superpowers/plans/2026-03-30-remove-qt-from-topp-tools.md, docs/superpowers/specs/2026-03-30-remove-qt-from-topp-tools-design.md
Add detailed two‑phase plan and design doc to remove Qt from TOPP, listing tool refactors, CMake changes, relocation of GUI tools, and verification steps.
Top-level CMake ordering
src/CMakeLists.txt
Move add_subdirectory(topp) earlier so TOPP initializes before GUI wiring and TOPP tool list population.

Sequence Diagram(s)

sequenceDiagram
  participant MetaProSIP as MetaProSIP
  participant ExternalProcess as ExternalProcess
  participant R as R (interpreter)
  participant FileSys as File (OpenMS)

  MetaProSIP->>ExternalProcess: build R cmd (--vanilla, --file=script.R, env R_LIBS=tmp_path)
  ExternalProcess->>R: spawn R process, capture stdout+stderr
  R-->>ExternalProcess: stdout/stderr (merged)
  ExternalProcess-->>MetaProSIP: return state + merged output
  MetaProSIP->>FileSys: copy generated plot files tmp_path -> output_dir
  MetaProSIP->>FileSys: remove temp files (if debug_level<1)
Loading

Possibly related issues

Possibly related PRs

Suggested reviewers

  • cbielow

"I hopped through code and nibbled Qt,
Replaced old vines with std's fresh root.
Stems and lists now tidy in File's care,
TOPP hops lighter — carrot dreams to share! 🥕"

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.58% 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 directly summarizes the primary change: removing Qt dependency from TOPP tools across 11 refactored tools, CMake changes, and new File API methods.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/remove-qt-from-topp

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

🧹 Nitpick comments (1)
src/topp/CometAdapter.cpp (1)

306-306: Use OpenMS primitive type for comet_year.

Please switch int to Int in this newly added line to stay consistent with project type conventions.

♻️ Proposed fix
-      const int comet_year = std::stoi(match[1].str());
+      const Int comet_year = static_cast<Int>(std::stoi(match[1].str()));

As per coding guidelines, "Use OpenMS primitive types from OpenMS/CONCEPT/Types.h instead of standard C++ types".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/topp/CometAdapter.cpp` at line 306, The declaration uses a standard C++
type for comet_year; change its type from int to OpenMS primitive Int to follow
project conventions (replace the line declaring comet_year: "const int
comet_year = std::stoi(match[1].str());" with a declaration using Int and assign
using std::stoi or equivalent). Update the symbol comet_year in CometAdapter.cpp
so it uses OpenMS/CONCEPT/Types.h's Int type and ensure any includes already
provide that typedef.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/superpowers/plans/2026-03-30-remove-qt-from-topp-tools.md`:
- Around line 1064-1067: The cmake reconfigure step in "Step 8: Build with
WITH_GUI=OFF" is using positional args and treats OpenMS-build as the source;
change the command to use explicit -S (source) and -B (build) flags so the
source root and build directory are unambiguous when running from the repo root;
update the text that references the cmake invocation (the line that currently
shows `cmake -DWITH_GUI=OFF OpenMS-build && cmake --build OpenMS-build
-j$(nproc)`) to use -S and -B respectively and keep the subsequent build
invocation targeting the same build directory name.

In `@src/openms_gui/CMakeLists.txt`:
- Around line 98-101: The current CMake logic appends GUI_TOPP_TOOLS
(ExecutePipeline, ImageCreator, INIUpdater) into the cached TOPP_TOOLS before
TOPP_TOOLS is initialized by topp, causing the topp write to overwrite the GUI
entries; fix by either moving add_subdirectory(topp) to execute before
add_subdirectory(openms_gui) in src/CMakeLists.txt so topp initializes
TOPP_TOOLS first, or change the GUI append in src/openms_gui/CMakeLists.txt to
update TOPP_TOOLS after topp runs (or append without CACHE FORCE so it preserves
existing cached values) — target the symbols add_subdirectory(openms_gui),
add_subdirectory(topp), GUI_TOPP_TOOLS and TOPP_TOOLS when making the change.

In `@src/topp/MetaProSIP.cpp`:
- Around line 476-485: The startup diagnostic string error_msg produced by
ExternalProcess::run (used in runRScript via variables proc, error_msg,
r_executable, args) is never surfaced; update the failure handling after
proc.run so that when state != 0 or error_msg is non-empty you include error_msg
in the logged/returned failure details (e.g., append it to
merged_output/captured_output or include it in the error log message) instead of
only the generic “process returned with non 0 status” message; ensure the same
change touches all new failure paths so missing R, permission or launch errors
are visible.

---

Nitpick comments:
In `@src/topp/CometAdapter.cpp`:
- Line 306: The declaration uses a standard C++ type for comet_year; change its
type from int to OpenMS primitive Int to follow project conventions (replace the
line declaring comet_year: "const int comet_year = std::stoi(match[1].str());"
with a declaration using Int and assign using std::stoi or equivalent). Update
the symbol comet_year in CometAdapter.cpp so it uses OpenMS/CONCEPT/Types.h's
Int type and ensure any includes already provide that typedef.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 48632921-47a5-4df9-adc9-96cda9c0ffa1

📥 Commits

Reviewing files that changed from the base of the PR and between 277948c and f493241.

📒 Files selected for processing (27)
  • cmake/cmake_findExternalLibs.cmake
  • cmake/knime_package_support.cmake
  • docs/superpowers/plans/2026-03-30-remove-qt-from-topp-tools.md
  • docs/superpowers/specs/2026-03-30-remove-qt-from-topp-tools-design.md
  • src/openms/source/APPLICATIONS/ToolHandler.cpp
  • src/openms_gui/CMakeLists.txt
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/ExecutePipeline.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/INIUpdater.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/ImageCreator.cpp
  • src/openms_gui/source/VISUAL/APPLICATIONS/GUITOOLS/executables.cmake
  • src/tests/topp/CMakeLists.txt
  • src/topp/AssayGeneratorMetaboSirius.cpp
  • src/topp/CMakeLists.txt
  • src/topp/CometAdapter.cpp
  • src/topp/IDRipper.cpp
  • src/topp/MetaProSIP.cpp
  • src/topp/MzMLSplitter.cpp
  • src/topp/OpenSwathFileSplitter.cpp
  • src/topp/OpenSwathWorkflow.cpp
  • src/topp/QCEmbedder.cpp
  • src/topp/QCExporter.cpp
  • src/topp/QCExtractor.cpp
  • src/topp/QCImporter.cpp
  • src/topp/QCMerger.cpp
  • src/topp/QCShrinker.cpp
  • src/topp/Resampler.cpp
  • src/topp/executables.cmake
💤 Files with no reviewable changes (6)
  • src/topp/QCImporter.cpp
  • src/topp/Resampler.cpp
  • src/topp/QCExporter.cpp
  • src/openms/source/APPLICATIONS/ToolHandler.cpp
  • src/topp/QCMerger.cpp
  • src/topp/CMakeLists.txt

Comment thread src/openms_gui/CMakeLists.txt Resolved
Comment thread src/topp/MetaProSIP.cpp Resolved
timosachsenberg and others added 5 commits March 30, 2026 18:13
Adds File::stemName(path) as a convenience wrapper around
FileHandler::stripExtension(File::basename(path)), covering the pattern
that appears 32 times across the codebase.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Adds File::listDirectories() static method that returns a sorted StringList
of subdirectory paths (non-recursive) using std::filesystem, with no-throw
semantics via std::error_code. Includes unit tests.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…makeDir()

Replace FileHandler::stripExtension(File::basename(...)) with File::stemName(...)
across 17 call sites in 10 TOPP tools. Replace raw std::filesystem calls with
File API methods in AssayGeneratorMetaboSirius, MzMLSplitter, and MetaProSIP.
Remove unnecessary #include <filesystem> and #include <FileHandler.h> where
they are no longer needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Swap add_subdirectory order in src/CMakeLists.txt: topp before
  openms_gui so TOPP_TOOLS cache is initialized before GUI appends.
  Fixes CWL/CTD generation for moved GUI tools.
- Surface ExternalProcess error_msg in MetaProSIP's runRScript helper
  so startup failures (missing R, permissions) are visible in logs.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@timosachsenberg

Copy link
Copy Markdown
Contributor Author

Re: CodeRabbit TOPP_TOOLS ordering issue — Fixed in dd02038. Swapped add_subdirectory order in src/CMakeLists.txt: topp now runs before openms_gui so TOPP_TOOLS cache is initialized before the GUI appends to it.

Re: MetaProSIP error_msg — Fixed in dd02038. error_msg from ExternalProcess::run() is now appended to merged output so startup diagnostics are visible.

Re: Plan docs cmake command — This is in plan documentation (already executed), not production code. No action needed.

@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

Caution

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

⚠️ Outside diff range comments (1)
src/topp/ProteinQuantifier.cpp (1)

630-635: ⚠️ Potential issue | 🟠 Major

Don’t strip an already-normalized stem again.

design_group_fraction_filename is already filled with File::stemName(f.path) at Lines 571-572. Reapplying File::stemName() here turns names like sample.v1.mzML into sample, so the channel_level_abundances lookup can silently miss and detailed file_and_channel_level_output rows collapse to zeroes.

Suggested fix
           for (auto [fraction, design_filename] : fraction_to_filename_map)
           {
-            // Process each filename within the fraction group
-            // important: strip file extension and path to find the entry
-            design_filename = File::stemName(design_filename);
+            // `design_filename` was already normalized when the map was built.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/topp/ProteinQuantifier.cpp` around lines 630 - 635, The loop over
fraction_to_filename_map currently reassigns design_filename using
File::stemName(design_filename) which double-normalizes names (File::stemName
was already applied when populating design_group_fraction_filename), causing
channel_level_abundances lookups and file_and_channel_level_output to miss
entries; remove the extra File::stemName call in the loop and use the incoming
design_filename as-is so lookups against channel_level_abundances and the logic
that writes file_and_channel_level_output use the correct stem-preserved keys.
🧹 Nitpick comments (2)
src/openms/include/OpenMS/SYSTEM/File.h (1)

140-156: Document these new public APIs with full Doxygen tags.

The new File methods are exported from a public header, but the added docs still omit @brief, @param[in], and @return. Please switch these to full Doxygen blocks so the generated API docs stay complete and consistent.

As per coding guidelines, "src/openms/include/OpenMS/**/*.h: Add Doxygen comments for new public methods and classes" and "Document all method parameters with @param[in], @param[out], or @param[in,out] tags; use @brief as required first line; document return values with @return."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/openms/include/OpenMS/SYSTEM/File.h` around lines 140 - 156, Add full
Doxygen blocks for the three new public methods File::stemName, File::extension,
and File::listDirectories: prepend each comment with an `@brief` one-line summary,
add `@param`[in] file (or dir) describing the expected input (e.g.,
absolute/relative path and behavior for non-existent paths), and add an `@return`
that explains the returned value (e.g., basename without extensions, extension
including leading dot or empty string, sorted list of absolute-style directory
paths). Ensure tags use `@param`[in] for inputs and document edge cases mentioned
in the prose (compound extensions, directories with dots, non-directory returns
empty list). Make these changes in the public header so generated API docs
include complete parameter and return documentation.
src/tests/class_tests/openms/source/File_test.cpp (1)

188-191: Assert the empty-string branch directly.

The new API contract says listDirectories("") returns an empty list, but this section currently only checks that the call does not crash. Please add an explicit assertion so that edge case stays covered.

Suggested test tweak
   // empty string returns empty list (not a directory)
   StringList from_empty = File::listDirectories("");
-  // just verify it doesn't crash - result depends on cwd
+  TEST_EQUAL(from_empty.size(), 0);

Based on learnings, "Write unit tests for new functionality and ensure existing tests pass before suggesting changes".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/tests/class_tests/openms/source/File_test.cpp` around lines 188 - 191,
The test currently calls File::listDirectories("") into variable from_empty but
only verifies it doesn't crash; change the test to explicitly assert the new API
contract by adding an assertion that from_empty is empty (e.g., check
from_empty.empty() or size()==0) so the empty-string branch is directly
validated; locate the assertion near the existing variable from_empty in the
File_test.cpp test section that uses File::listDirectories("") and add the
empty-list check for from_empty.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/openms/source/SYSTEM/File.cpp`:
- Around line 351-366: In File::listDirectories, ensure returned paths are
absolute and that no exceptions are thrown: when iterating entries from
fs::directory_iterator(dir_path, ec) call entry.is_directory(entry_ec) (the
error-code overload) and skip entries that set entry_ec or return false; for
entries that are directories, compute an absolute path using
fs::absolute(entry.path(), abs_ec) and push abs_path.generic_string() only if
abs_ec is clear; reset/declare fresh std::error_code variables (e.g., entry_ec
and abs_ec) for each check so OS errors are handled silently and the function
preserves the documented no-throw and absolute-path contracts.

---

Outside diff comments:
In `@src/topp/ProteinQuantifier.cpp`:
- Around line 630-635: The loop over fraction_to_filename_map currently
reassigns design_filename using File::stemName(design_filename) which
double-normalizes names (File::stemName was already applied when populating
design_group_fraction_filename), causing channel_level_abundances lookups and
file_and_channel_level_output to miss entries; remove the extra File::stemName
call in the loop and use the incoming design_filename as-is so lookups against
channel_level_abundances and the logic that writes file_and_channel_level_output
use the correct stem-preserved keys.

---

Nitpick comments:
In `@src/openms/include/OpenMS/SYSTEM/File.h`:
- Around line 140-156: Add full Doxygen blocks for the three new public methods
File::stemName, File::extension, and File::listDirectories: prepend each comment
with an `@brief` one-line summary, add `@param`[in] file (or dir) describing the
expected input (e.g., absolute/relative path and behavior for non-existent
paths), and add an `@return` that explains the returned value (e.g., basename
without extensions, extension including leading dot or empty string, sorted list
of absolute-style directory paths). Ensure tags use `@param`[in] for inputs and
document edge cases mentioned in the prose (compound extensions, directories
with dots, non-directory returns empty list). Make these changes in the public
header so generated API docs include complete parameter and return
documentation.

In `@src/tests/class_tests/openms/source/File_test.cpp`:
- Around line 188-191: The test currently calls File::listDirectories("") into
variable from_empty but only verifies it doesn't crash; change the test to
explicitly assert the new API contract by adding an assertion that from_empty is
empty (e.g., check from_empty.empty() or size()==0) so the empty-string branch
is directly validated; locate the assertion near the existing variable
from_empty in the File_test.cpp test section that uses File::listDirectories("")
and add the empty-list check for from_empty.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 54e2dedc-4f84-4815-9ddd-30efa6311a24

📥 Commits

Reviewing files that changed from the base of the PR and between f493241 and 0bc3af9.

📒 Files selected for processing (16)
  • docs/superpowers/plans/2026-03-30-file-api-improvements.md
  • src/openms/include/OpenMS/SYSTEM/File.h
  • src/openms/source/SYSTEM/File.cpp
  • src/tests/class_tests/openms/source/File_test.cpp
  • src/topp/AssayGeneratorMetaboSirius.cpp
  • src/topp/ConsensusID.cpp
  • src/topp/MascotAdapterOnline.cpp
  • src/topp/MetaProSIP.cpp
  • src/topp/MzMLSplitter.cpp
  • src/topp/OpenSwathFileSplitter.cpp
  • src/topp/ProteinQuantifier.cpp
  • src/topp/ProteomicsLFQ.cpp
  • src/topp/QCEmbedder.cpp
  • src/topp/QCExtractor.cpp
  • src/topp/QCShrinker.cpp
  • src/topp/SpectraSTSearchAdapter.cpp
✅ Files skipped from review due to trivial changes (4)
  • src/topp/QCShrinker.cpp
  • src/topp/AssayGeneratorMetaboSirius.cpp
  • src/topp/MascotAdapterOnline.cpp
  • src/topp/OpenSwathFileSplitter.cpp
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/topp/QCExtractor.cpp
  • src/topp/QCEmbedder.cpp
  • src/topp/MzMLSplitter.cpp

Comment thread src/openms/source/SYSTEM/File.cpp Resolved

@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.

♻️ Duplicate comments (1)
src/topp/MetaProSIP.cpp (1)

566-570: ⚠️ Potential issue | 🟡 Minor

Surface runRScript() output in the remaining failure paths.

The dependency-install branch is fixed now, but these branches still discard the merged stdout/stderr and only emit generic failures. That leaves plot-script errors, bad R paths, and startup diagnostics opaque again. In the two plot helpers, please also pass the local debug_level instead of hardcoding 0.

🛠️ Suggested change
-      auto state = runRScript(executable, script_filename, tmp_path, 0);
+      String captured_output;
+      auto state = runRScript(executable, script_filename, tmp_path, 0, &captured_output);
       if (state != ExternalProcess::RETURNSTATE::SUCCESS)
       {
         OPENMS_LOG_INFO << " failed" << std::endl;
-        OPENMS_LOG_ERROR << "Can't execute R. Do you have R installed? Check if the path to R is in your system path variable." << std::endl;
+        OPENMS_LOG_ERROR << "Can't execute R. Do you have R installed? Check if the path to R is in your system path variable.\n"
+                         << captured_output << std::endl;
         return false;
       }
-      auto state = runRScript(executable, tmp_path + "/" + script_filename, tmp_path, 0);
+      String captured_output;
+      auto state = runRScript(executable, tmp_path + "/" + script_filename, tmp_path, debug_level, &captured_output);
       if (state != ExternalProcess::RETURNSTATE::SUCCESS)
       {
-        std::cerr << "Error: Process returned with non 0 status." << std::endl;
+        OPENMS_LOG_ERROR << "R plot generation failed:\n" << captured_output << '\n';
       }

As per coding guidelines, "Use OpenMS logging macros and OpenMS::LogStream; avoid std::cout/std::err directly".

Also applies to: 633-637, 844-848, 2047-2052

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/topp/MetaProSIP.cpp` around lines 566 - 570, Replace direct
std::cerr/std::cout uses in the runRScript failure branches with OpenMS logging
(e.g. OPENMS_LOG_ERROR or OpenMS::LogStream) and include the merged
stdout/stderr returned by runRScript when ExternalProcess::RETURNSTATE::SUCCESS
is not returned (use the variable that holds the merged output alongside state
and script_filename/tmp_path for context). Also update the two plot helper calls
that currently pass 0 to instead forward the local debug_level variable so their
R invocations receive proper verbosity. Apply the same replacement (use OpenMS
logging and surface merged stdout/stderr) for the other occurrences noted (the
similar failure branches around the other runRScript calls).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/topp/MetaProSIP.cpp`:
- Around line 566-570: Replace direct std::cerr/std::cout uses in the runRScript
failure branches with OpenMS logging (e.g. OPENMS_LOG_ERROR or
OpenMS::LogStream) and include the merged stdout/stderr returned by runRScript
when ExternalProcess::RETURNSTATE::SUCCESS is not returned (use the variable
that holds the merged output alongside state and script_filename/tmp_path for
context). Also update the two plot helper calls that currently pass 0 to instead
forward the local debug_level variable so their R invocations receive proper
verbosity. Apply the same replacement (use OpenMS logging and surface merged
stdout/stderr) for the other occurrences noted (the similar failure branches
around the other runRScript calls).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8702dd51-8939-4349-85b7-dfd757da9d8e

📥 Commits

Reviewing files that changed from the base of the PR and between 0bc3af9 and dd02038.

📒 Files selected for processing (2)
  • src/CMakeLists.txt
  • src/topp/MetaProSIP.cpp

…lute paths

Use is_directory(ec) and fs::absolute() to honor the documented
no-throw and absolute-path contracts.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
timosachsenberg and others added 2 commits March 30, 2026 23:56
std::filesystem::path(std::string) uses the current code page on Windows,
not UTF-8. Use OpenMS::to_path() from PathUtils.h instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Replace all 15 remaining FileHandler::stripExtension(File::basename())
call sites in src/openms/ and src/openms_gui/ with File::stemName().
Remove FileHandler.h includes where no longer needed.
Remove superpowers spec and plan documents.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@timosachsenberg
timosachsenberg merged commit 7158c1d into develop Mar 31, 2026
41 checks passed
@timosachsenberg
timosachsenberg deleted the feature/remove-qt-from-topp branch March 31, 2026 13:50
github-actions Bot pushed a commit that referenced this pull request Apr 1, 2026
Add missing entry for #9041 (remove Qt dependency from TOPP tools):
- Qt6::Core removed from all non-GUI TOPP tools in Dependencies section
- Qt6 find_package guarded by WITH_GUI in Build System section

Co-authored-by: Copilot <[email protected]>
timosachsenberg pushed a commit that referenced this pull request Apr 1, 2026
Add missing entry for #9041 (remove Qt dependency from TOPP tools):
- Qt6::Core removed from all non-GUI TOPP tools in Dependencies section
- Qt6 find_package guarded by WITH_GUI in Build System section

Co-authored-by: GitHub Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
github-actions Bot pushed a commit that referenced this pull request Apr 2, 2026
The Qt refactoring in #9041 removed all Qt dependencies from TOPP tools
by replacing QFile, QDir, QFileInfo, QByteArray etc. with std::filesystem,
OpenMS File utilities, and Base64. Qt6 is now only required for the GUI
library (openms_gui / WITH_GUI), not for the command-line TOPP tools.

Co-authored-by: Copilot <[email protected]>
timosachsenberg pushed a commit that referenced this pull request Apr 2, 2026
…9060)

The Qt refactoring in #9041 removed all Qt dependencies from TOPP tools
by replacing QFile, QDir, QFileInfo, QByteArray etc. with std::filesystem,
OpenMS File utilities, and Base64. Qt6 is now only required for the GUI
library (openms_gui / WITH_GUI), not for the command-line TOPP tools.

Co-authored-by: GitHub Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
@coderabbitai coderabbitai Bot mentioned this pull request Apr 25, 2026
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.

2 participants