Skip to content

Split GpgIdSigner::haveSecretKey and StoreModel::showThis - #2428

Merged
annejan merged 1 commit into
mainfrom
refactor/complexity-2157-b7
Dec 1, 2026
Merged

annejan merged 1 commit into
mainfrom
refactor/complexity-2157-b7

Conversation

@annejan

@annejan annejan commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Part of #2157, batch 7. Only the structure changes: the extracted code is moved as it was, comments included.

Function CCN before after New
GpgIdSigner::haveSecretKey 22 3 signingBlocks() (12), signsWith() (9)
StoreModel::showThis 21 14 showsFolder() (8)
  • haveSecretKey() keeps the gpg --list-secret-keys run. The colon-listing parse moves to signingBlocks(), and the fingerprint match to signsWith(). Both helpers sit in an anonymous namespace with the Key struct, which was local to the function before. The comment on the records goes with the parse, and the comment on subkey versus primary goes with the match.
  • showThis() hands the branch for a folder with rows to showsFolder(): any shown row, or, in a search, the folder's own name.

Test plan

  • qmake6 -r CONFIG+=rnp && make -j12 && make check in a scratch HOME/GNUPGHOME: 37 suites, 2,079 passed, 0 failed
  • doxygen Doxyfile: no warnings
  • lizard -C 14 shows no warnings in these two files

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • GPG signing now recognizes signing-capable subkeys and handles invalid primary-key entries more reliably.
    • Store searches now show matching folders when their names match the search, while continuing to show folders with matching contents. Folders outside the store and .git paths remain excluded.

Part of #2157. Behaviour-preserving extractions, comments moved verbatim:

- GpgIdSigner::haveSecretKey (CCN 22 to 3): the colon-listing parse moves
  to signingBlocks() (12) and the fingerprint match to signsWith() (9),
  both in an anonymous namespace with the Key struct.
- StoreModel::showThis (CCN 21 to 14): the folder-with-rows branch moves
  to showsFolder() (8).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Anne Jan Brouwer <[email protected]>
@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The PR extracts GPG key-list parsing and matching into helper functions. It also moves folder visibility checks from StoreModel::showThis into a new private helper.

Changes: GPG key matching

Layer / File(s) Summary
Parse and match signing keys
src/gpgidsigner.cpp
signingBlocks() parses secret-key listings into key blocks, and signsWith() checks signing capability and fingerprints. haveSecretKey() uses these helpers while retaining its existing checks and GPG listing behavior.

Store folder visibility

Layer / File(s) Summary
Evaluate folder visibility
src/storemodel.h, src/storemodel.cpp
StoreModel declares showsFolder() and calls it from showThis() for directories with children. The helper checks child visibility and applies the existing folder-name search conditions.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Possibly related issues

  • IJHack/QtPass#2157: The issue lists haveSecretKey and showThis for function splitting, and this PR extracts helpers from both.

Possibly related PRs

  • IJHack/QtPass#2276: This PR refactors the key-record parsing and fingerprint matching logic introduced by that PR.

Suggested reviewers: nogeenhenk

Merge Risk: Minimal · up to 90efe

This is a structural refactor with no intended behavior change. No concrete merge risk was identified, and the author reports the full test suite passing.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the two functions that the refactor splits, GpgIdSigner::haveSecretKey and StoreModel::showThis. The changeset matches this: haveSecretKey delegates parsing to signingBlocks() and matc…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two functions that the refactor splits, GpgIdSigner::haveSecretKey and StoreModel::showThis. The changeset matches this: haveSecretKey delegates parsing to signingBlocks() and matching to signsWith(), and showThis delegates folder visibility to the new showsFolder() helper. The title says 'Split' but does not name the new helpers or describe the purpose (complexity reduction), which is acceptable because the title need not cover every detail.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks each key with care,
Then sorts the folders in its lair.
It finds the signs and paths that show,
And hops through rows in tidy flow.
The helpers spring, the checks stay clear.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI (base), Organization UI (inherited)
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 2ec4caa1-f8ed-4245-8cf2-b913802dc876
Commits

Reviewing files that changed from the base of the PR and between 5f3fa93 and 90efee6.

Files selected for processing: 3

  • src/gpgidsigner.cpp
  • src/storemodel.cpp
  • src/storemodel.h

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 94.557% (+0.003%) from 94.554% — refactor/complexity-2157-b7 into main

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

Reviewed at 90efee6. The seventh refactor for #2157; only the structure changes.

  • GpgIdSigner::haveSecretKey: the gpg --list-secret-keys run and its early returns stay; signingBlocks() is the old parse unchanged (it never used the configured key), and signsWith() the old match, with the same block and subkey rules. Key moves to the anonymous namespace; nothing else in the file is called that.
  • StoreModel::showThis: showsFolder() is the old branch for a folder with rows, unchanged, recursion through showThis() included.

Nothing to add.


Generated by Claude Code

@annejan
annejan merged commit ffa74be into main Dec 1, 2026
33 checks passed
@annejan
annejan deleted the refactor/complexity-2157-b7 branch December 1, 2026 04:16
@annejan annejan mentioned this pull request Dec 1, 2026
18 of 40 tasks
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