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

squinky86 / STIGQter / 41772281141

04 Nov 2026 04:16AM UTC coverage: 68.902% (-7.0%) from 75.946%
41772281141

push

github

squinky86
Refactor STIGQter and modernize build and update services

8082 of 13137 branches covered (61.52%)

Branch coverage included in aggregate %.

2404 of 2696 new or added lines in 30 files covered. (89.17%)

9 existing lines in 8 files now uncovered.

5914 of 7176 relevant lines covered (82.41%)

38491.09 hits per line

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

58.14
/src/control.cpp
1
/*
2
 * STIGQter - STIG fun with Qt
3
 *
4
 * Copyright © 2018–2023 Jon Hood, http://www.hoodsecurity.com/
5
 *
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19

20
#include "control.h"
21
#include "dbmanager.h"
22

23
/**
24
 * @class Control
25
 * @brief A @a Control corresponds to a particular RMF checklist
26
 * grouping of assessment procedures. The RMF hierarchy consists of
27
 * @a Family → @a Control → @a CCI.
28
 *
29
 * A @a Control is the base unit of RMF by which assessment scoring
30
 * takes place. Risk calculations roll up and are reported at the
31
 * @a Control level to provide management with a high-level overview
32
 * of the security posture of a system.
33
 *
34
 * Selection of applicable controls is performed by baselining and
35
 * tailoring the system's capabilities and security needs.
36
 */
37

38
/**
39
 * @brief Control::Control
40
 * @param parent
41
 *
42
 * Default constructor.
43
 */
44
Control::Control(QObject *parent) : QObject(parent),
753,835 ✔
45
    id(-1),
753,835 ✔
46
    familyId(-1),
753,835 ✔
47
    number(0),
753,835 ✔
48
    enhancement(),
753,835 ✔
49
    title(),
753,835 ✔
50
    description(),
753,835 ✔
51
    importSeverity(),
753,835 ✔
52
    importRelevanceOfThreat(),
753,835 ✔
53
    importLikelihood(),
753,835 ✔
54
    importImpact(),
753,835 ✔
55
    importImpactDescription(),
753,835 ✔
56
    importResidualRiskLevel(),
753,835 ✔
57
    importRecommendations()
1,507,670 ✔
58
{
59
}
753,835 ✔
60

61
/**
62
 * @brief Control::Control
63
 * @param right
64
 *
65
 * Copy constructor.
66
 */
67
Control::Control(const Control &right) : Control(right.parent())
552,233 ✔
68
{
69
    *this = right;
552,233 ✔
70
}
552,233 ✔
71

72
/**
73
 * @brief Control::GetFamily
74
 * @return The @a Family associated with this @a Control
75
 */
76
Family Control::GetFamily() const
10,308 ✔
77
{
78
    DbManager db;
10,308 ✔
79
    return db.GetFamily(familyId);
20,616 ✔
80
}
10,308 ✔
81

82
QVector<CCI> Control::GetCCIs() const
×
83
{
84
    DbManager db;
×
85
    return db.GetCCIs(*this);
×
86
}
×
87

88
/**
89
 * @brief Control::operator=
90
 * @param right
91
 * @return This @a Control, copied from the assignee.
92
 *
93
 * Deep copy assignment operator.
94
 */
95
Control& Control::operator=(const Control &right)
552,233 ✔
96
{
97
    if (this != &right)
552,233 !
98
    {
99
        id = right.id;
552,233 ✔
100
        familyId = right.familyId;
552,233 ✔
101
        number = right.number;
552,233 ✔
102
        enhancement = right.enhancement;
552,233 ✔
103
        title = right.title;
552,233 ✔
104
        description = right.description;
552,233 ✔
105
        importSeverity = right.importSeverity;
552,233 ✔
106
        importRelevanceOfThreat = right.importRelevanceOfThreat;
552,233 ✔
107
        importLikelihood = right.importLikelihood;
552,233 ✔
108
        importImpact = right.importImpact;
552,233 ✔
109
        importImpactDescription = right.importImpactDescription;
552,233 ✔
110
        importResidualRiskLevel = right.importResidualRiskLevel;
552,233 ✔
111
        importRecommendations = right.importRecommendations;
552,233 ✔
112
    }
113
    return *this;
552,233 ✔
114
}
115

116
/**
117
 * @brief Control::IsImport
118
 * @return @c True when a CCI has been imported under this control.
119
 * Otherwise, @c false.
120
 */
121
bool Control::IsImport() const
×
122
{
123
    for (auto cci : GetCCIs())
×
124
    {
125
        if (cci.isImport)
×
126
            return true;
×
127
    }
×
128
    return false;
×
129
}
130

131
/**
132
 * @brief Control::operator==
133
 * @param right
134
 * @return @c True when the @a Control entities refer to the same
135
 * @a Control. Otherwise, @c false.
136
 */
137
bool operator==(Control const& lhs, Control const& rhs)
×
138
{
139
    return (PrintControl(lhs).compare(PrintControl(rhs), Qt::CaseInsensitive) == 0);
×
140
}
141

142
/**
143
 * @brief PrintControl
144
 * @param control
145
 * @return Human-readable @a Control
146
 */
147
[[nodiscard]] QString PrintControl(const Control &control)
10,308 ✔
148
{
149
    QString ret = control.GetFamily().acronym + "-" + QString::number(control.number);
10,308 ✔
150
    if (control.enhancement > 0)
10,308 !
151
        ret.append("(" + QString::number(control.enhancement) + ")");
×
152
    return ret;
10,308 ✔
UNCOV
153
}
×
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