• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IJHack / QtPass / 27688530046

17 Jun 2026 12:21PM UTC coverage: 57.501% (+0.02%) from 57.477%
27688530046

push

github

web-flow
refactor(pass): inject AppSettings into Pass hierarchy (PR A of #1511) (#1551)

* refactor(pass): inject AppSettings into Pass hierarchy (PR A of #1511)

- Pass::init(AppSettings) replaces no-arg init(); backends store
  m_settings and read executables/paths from it instead of calling
  QtPassSettings getters at runtime
- ImitatePass::pgit/pgpg converted from static free functions to const
  member functions; grepMatchFile (static) inlines the wslpath check
  using its gpgExe parameter
- PassBackendFactory::getPass() loads AppSettings via QtPassSettings::load()
  and normalises passStore via QtPassSettings::getPassStore(), then passes
  the snapshot to pass->init(s)
- realpass.cpp and imitatepass.cpp no longer include qtpasssettings.h
- Integration test and tst_util updated: call pass.init(s) after
  configuring QtPassSettings so m_settings is populated before updateEnv()

Two QtPassSettings calls remain in passbackendfactory.cpp (load + getPassStore);
removal of getGpgIdPath's QtPassSettings dependency is deferred to PR C.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: apply CodeRabbit auto-fixes

Fixed 2 file(s) based on 3 unresolved review comments.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>

* fix: address review findings on AppSettings injection

- keygendialog: pass getGpgExecutable() to getDefaultKeyTemplate() so
  gpgSupportsEd25519 uses the configured binary, not the "gpg" fallback
  (P1: silent regression on systems where gpg is GPG 1.x but user
  configured gpg2)
- QtPassSettings::load(): normalise passStore (absolutePath + trailing
  slash) so callers get a usable path without a separate getPassStore()
  override; SettingsSerializer::load() preserves raw stored value for
  round-trip fidelity (P2: duplicate override pattern removed)
- passbackendfactory: drop s.passStore = getPassStore() override; inline
  mkdir for first-run directory creation
- pass.cpp: fix clang-format violations (ColumnLimit=80 line breaks... (continued)

52 of 92 new or added lines in 6 files covered. (56.52%)

13 existing lines in 6 files now uncovered.

3990 of 6939 relevant lines covered (57.5%)

23.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.24
/src/passbackendfactory.cpp
1
// SPDX-FileCopyrightText: 2016 Anne Jan Brouwer
2
// SPDX-License-Identifier: GPL-3.0-or-later
3

4
/**
5
 * @class PassBackendFactory
6
 * @brief Pass backend lifecycle implementation.
7
 *
8
 * @see passbackendfactory.h
9
 */
10

11
#include "passbackendfactory.h"
12
#include "appsettings.h"
13
#include "pass.h"
14
#include "qtpasssettings.h"
15

16
#include <QDir>
17

18
Pass *PassBackendFactory::pass = nullptr;
19
QScopedPointer<RealPass> PassBackendFactory::realPass;
20
QScopedPointer<ImitatePass> PassBackendFactory::imitatePass;
21

22
auto PassBackendFactory::getPass() -> Pass * {
41✔
23
  if (!pass) {
41✔
24
    AppSettings s = QtPassSettings::load();
13✔
25
    // Ensure store directory exists (first-run side effect — load() normalises
26
    // the path but does not create the directory).
27
    if (!QDir(s.passStore).exists())
13✔
28
      QDir().mkpath(s.passStore);
2✔
29
    if (s.usePass) {
13✔
UNCOV
30
      pass = getRealPass();
×
31
    } else {
32
      pass = getImitatePass();
13✔
33
    }
34
    if (pass) {
13✔
35
      pass->init(s);
13✔
36
    }
37
  }
13✔
38
  return pass;
41✔
39
}
40

41
auto PassBackendFactory::getRealPass() -> RealPass * {
12✔
42
  if (realPass.isNull()) {
12✔
43
    realPass.reset(new RealPass());
1✔
44
  }
45
  return realPass.data();
12✔
46
}
47

48
auto PassBackendFactory::getImitatePass() -> ImitatePass * {
49✔
49
  if (imitatePass.isNull()) {
49✔
50
    imitatePass.reset(new ImitatePass());
2✔
51
  }
52
  return imitatePass.data();
49✔
53
}
54

55
void PassBackendFactory::invalidate() { pass = nullptr; }
19✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc