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

IJHack / QtPass / 47014498214

03 Dec 2026 01:47AM UTC coverage: 94.59% (-0.008%) from 94.598%
47014498214

push

github

web-flow
Coverity Scan: move instead of copy at last uses, and two unchecked results (#2476)

The first Coverity Scan build since May (#2443, #2475) reported 31
findings in src/. None is a bug in behaviour.

- COPY_INSTEAD_OF_MOVE, 25: a QString, QStringList, QByteArray, QPointer
  or shared_ptr was copied at its last use. Each is now moved, or the
  temporary is passed directly (KeygenDialog::replace, NativeGrep::search).
  Two more of the same kind in MainWindow that Coverity did not list.
- CHECKED_RETURN, 2: a store folder that PassBackendFactory::getPass
  cannot make now gives the warning QtPassSettings::getPassStore gives.
  ~Executor does not use the result of the wait after kill(), on purpose:
  a cast to void says so.
- AUTO_CAUSES_COPY, 1: the lambda in ConfigDialog::showProblems names its
  return type, QString. clang-tidy 23 refuses the reference Coverity
  proposes (bugprone-return-const-ref-from-parameter).

Not changed, PASS_BY_VALUE, 3, marked intentional in Coverity: the
signer's lambda keeps its own copy of the settings (CID 512820),
OtpCodeWidget takes its settings by value and moves them into the member
(CID 512805), and the worker's lambda already takes the result by move
(CID 512806).

Signed-off-by: Anne Jan Brouwer <brouwer@annejan.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

25 of 26 new or added lines in 12 files covered. (96.15%)

11523 of 12182 relevant lines covered (94.59%)

29090.34 hits per line

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

96.3
/src/passbackendfactory.cpp
1
// SPDX-FileCopyrightText: 2016 Anne Jan Brouwer
2
// SPDX-License-Identifier: GPL-3.0-or-later
3
/**
4
 * @file
5
 * @brief Implements PassBackendFactory. The backends are held through
6
 * pointers and constructed on first use, so nothing depends on the
7
 * initialisation order of globals.
8
 */
9

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

16
#include <QDebug>
17
#include <QDir>
18

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

23
auto PassBackendFactory::getPass() -> Pass * {
860 ✔
24
  if (!pass) {
860 ✔
25
    // With the active profile's Git flags: what the backend runs with.
26
    AppSettings s = QtPassSettings::loadEffective();
294 ✔
27
    // Ensure store directory exists (first-run side effect — load() normalises
28
    // the path but does not create the directory).
29
    if (!QDir(s.passStore).exists() && !Util::mkpathForStore(s.passStore)) {
588 ✔
NEW
30
      qWarning() << "Failed to create password store directory:" << s.passStore;
×
31
    }
32
    if (s.usePass) {
294 ✔
33
      pass = getRealPass();
6 ✔
34
    } else {
35
      pass = getImitatePass();
288 ✔
36
    }
37
    if (pass) {
294 ✔
38
      pass->init(s);
294 ✔
39
    }
40
  }
294 ✔
41
  return pass;
860 ✔
42
}
43

44
auto PassBackendFactory::getRealPass() -> RealPass * {
475 ✔
45
  if (realPass.isNull()) {
475 ✔
46
    realPass.reset(new RealPass());
6 ✔
47
  }
48
  return realPass.data();
475 ✔
49
}
50

51
auto PassBackendFactory::getImitatePass() -> ImitatePass * {
953 ✔
52
  if (imitatePass.isNull()) {
953 ✔
53
    imitatePass.reset(new ImitatePass());
6 ✔
54
    AppSettings s = QtPassSettings::loadEffective();
6 ✔
55
    imitatePass->init(s);
6 ✔
56
  }
6 ✔
57
  return imitatePass.data();
953 ✔
58
}
59

60
auto PassBackendFactory::isIdle() -> bool {
385 ✔
61
  return (realPass.isNull() || realPass->isIdle()) &&
666 ✔
62
         (imitatePass.isNull() || imitatePass->isIdle());
385 ✔
63
}
64

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

© 2026 Coveralls, Inc