Skip to content

Fix AI code quality: usersdialog.cpp and tst_storemodel.cpp#836

Merged
annejan merged 2 commits intomainfrom
fix/usersdialog-cpp-ai-findings
Mar 29, 2026
Merged

Fix AI code quality: usersdialog.cpp and tst_storemodel.cpp#836
annejan merged 2 commits intomainfrom
fix/usersdialog-cpp-ai-findings

Conversation

@nogeenhenk
Copy link
Copy Markdown
Contributor

Summary

Fixed 8 AI-detected code quality findings:

src/usersdialog.cpp (4 findings)

  1. Return after reject(): Added return; after reject() to prevent undefined behavior when users list is empty
  2. N+1 query fix: Added missingKeyRecipients set to avoid redundant listKeys() calls for same recipient
  3. Debug logging: Added qWarning() for invalid index data in itemChange()
  4. QRegularExpression caching: Cache compiled regex in populateList() instead of recreating on each call

tests/auto/model/tst_storemodel.cpp (4 findings)

  • Fixed hardcoded row index 0 to use index.row() in 3 test functions:
    • filterAcceptsRowHidden()
    • filterExcludesGitDirectory()
    • filterAcceptsRowVisible()

Testing

  • Builds successfully
  • All unit tests pass (53 util + 17 model tests)

usersdialog.cpp:
- Add return after reject() to prevent undefined behavior
- Fix N+1 query pattern by caching checked recipients
- Add debug logging for invalid index validation
- Cache QRegularExpression in populateList()

tst_storemodel.cpp:
- Use index.row() instead of hardcoded 0 in filterAcceptsRow tests
@nogeenhenk nogeenhenk force-pushed the fix/usersdialog-cpp-ai-findings branch from cdcbd2f to fa60d2f Compare March 29, 2026 18:43
@coveralls
Copy link
Copy Markdown

coveralls commented Mar 29, 2026

Coverage Status

coverage: 18.335% (-0.03%) from 18.36%
when pulling fa60d2f on fix/usersdialog-cpp-ai-findings
into 8073d67 on main.

@nogeenhenk nogeenhenk changed the title Fix AI code quality findings Fix AI code quality: usersdialog.cpp and tst_storemodel.cpp Mar 29, 2026
@annejan annejan merged commit 033cd37 into main Mar 29, 2026
16 of 17 checks passed
@annejan annejan deleted the fix/usersdialog-cpp-ai-findings branch March 29, 2026 18:53
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.

3 participants