refactor(test/mainwindow): use QDir::filePath() for .gpg-id path construction#1491
Conversation
…truction QDir(dir).filePath(name) handles separator normalisation intrinsically and is more idiomatic Qt than manual string concatenation + cleanPath. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe test setup in initTestCase now constructs the ChangesTest initialization path normalization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/auto/mainwindow/tst_mainwindow.cpp`:
- Line 68: The change removed the required path normalization: wrap the result
of QDir(m_storeDir.path()).filePath(QStringLiteral(".gpg-id")) with
QDir::cleanPath() before constructing QFile (i.e., compute a cleaned path via
QDir::cleanPath(QDir(m_storeDir.path()).filePath(...))) and pass that to QFile
(affecting the QFile gpgId creation); this restores cross-platform normalization
per project guidelines.
🪄 Autofix (Beta)
✅ Autofix completed
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: ce082132-acc8-41e2-bbaf-276e54843fec
📒 Files selected for processing (1)
tests/auto/mainwindow/tst_mainwindow.cpp
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Fixes Applied SuccessfullyFixed 1 file(s) based on 1 unresolved review comment. Files modified:
Commit: The changes have been pushed to the Time taken: |
Fixed 1 file(s) based on 1 unresolved review comment. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
QDir::cleanPath(m_storeDir.path() + "/.gpg-id")withQDir(m_storeDir.path()).filePath(".gpg-id")— more idiomatic Qt path construction that handles separator normalisation intrinsically, without manual string concatenation.Skipped findings
tst_mainwindow→tst_MainWindow: every other test class in the project usestst_<lowercase>(tst_storemodel,tst_gpgkeystate,tst_configdialog, …). The rename would be inconsistent with the established convention.normalHtml != errorHtmlstyling assertion:flashTextcallssetTextColor(Qt::red)thensetText(text). For plain text,setText()delegates tosetPlainText()which resets the document with default formatting, discarding the char format set bysetTextColor(). Both calls produce identicaltoHtml()output, so the assertion would always fail.Test plan
--platform offscreen🤖 Generated with Claude Code
Summary by CodeRabbit