Skip to content

Commit

Permalink
fixes from Codacy
Browse files Browse the repository at this point in the history
  • Loading branch information
squinky86 committed Nov 25, 2019
1 parent 80e2540 commit 3761506
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
9 changes: 1 addition & 8 deletions CHANGES.md
Expand Up @@ -20,35 +20,28 @@
## 0.1.4 20190323

- CMRS import/export

- Automated check for latest version of software

## 0.1.3 20190318

- HTML output of STIG results

- Performance improvements

## 0.1.2 20190228

- Save to external .stigqter file

- Filter remaining STIGCheck list

## 0.1.1 20190221

- Support for eMASS TR report

- XCCDF/SCAP input

## 0.1.0 20190102

- First public beta

- Autosave CKL information to the database on a timer

- Keyboard shortcuts adde

- Keyboard shortcuts added
- Detailed Findings Report

## 0.0.2 20181218
Expand Down
31 changes: 17 additions & 14 deletions src/dbmanager.cpp
Expand Up @@ -124,7 +124,6 @@ DbManager::DbManager(const QString& path, const QString& connectionName)

int version = GetVariable(QStringLiteral("version")).toInt();
UpdateDatabaseFromVersion(version);

}

if (!db.open())
Expand Down Expand Up @@ -458,10 +457,12 @@ bool DbManager::AddSTIG(STIG stig, QList<STIGCheck> checks, bool stigExists)
QSqlDatabase db;
bool ret = false;
bool stigCheckRet = true; //turns "false" if a check fails to be added
int cci366Id = -1;

if (CheckDatabase(db))
{
QSqlQuery q(db);
int cci366Id = -1;

if (stig.id <= 0)
{
STIG tmpSTIG = GetSTIG(stig.title, stig.version, stig.release);
Expand Down Expand Up @@ -641,18 +642,21 @@ bool DbManager::DeleteAsset(const Asset &asset)
if (asset.GetSTIGs().count() > 0)
{
Warning(QStringLiteral("Asset Has Mapped STIGs"), "The Asset '" + PrintAsset(asset) + "' has STIGs selected that must be removed.");
return ret;
}
QSqlDatabase db;
if (CheckDatabase(db))
else
{
QSqlQuery q(db);
q.prepare(QStringLiteral("DELETE FROM Asset WHERE id = :AssetId"));
q.bindValue(QStringLiteral(":AssetId"), asset.id);
ret = q.exec();
if (!_delayCommit)
db.commit();
QSqlDatabase db;
if (CheckDatabase(db))
{
QSqlQuery q(db);
q.prepare(QStringLiteral("DELETE FROM Asset WHERE id = :AssetId"));
q.bindValue(QStringLiteral(":AssetId"), asset.id);
ret = q.exec();
if (!_delayCommit)
db.commit();
}
}

return ret;
}

Expand Down Expand Up @@ -1514,7 +1518,7 @@ QList<STIGCheck> DbManager::GetSTIGChecks(const QString &whereClause, const QLis
c.potentialImpact = q.value(18).toString();
c.thirdPartyTools = q.value(19).toString();
c.mitigationControl = q.value(20).toString();
c.thirdPartyTools = q.value(21).toString();
c.responsibility = q.value(21).toString();
c.iaControls = q.value(22).toString();
c.targetKey = q.value(23).toString();
foreach (CCI cci, GetCCIs(c.id))
Expand Down Expand Up @@ -1663,12 +1667,11 @@ Control DbManager::GetControl(const QString &control)
}
QString family(tmpControl.left(2));
tmpControl = tmpControl.right(tmpControl.length()-3);
QString enhancement = QString();
int enhancementInt = -1;
if (tmpControl.contains('('))
{
int tmpIndex = tmpControl.indexOf('(');
enhancement = tmpControl.right(tmpControl.length() - tmpIndex - 1);
QString enhancement = tmpControl.right(tmpControl.length() - tmpIndex - 1);
enhancement = enhancement.left(enhancement.length() - 1);
tmpControl = tmpControl.left(tmpControl.indexOf('('));
enhancementInt = enhancement.toInt(); //will return 0 if enhancement doesn't exist
Expand Down

0 comments on commit 3761506

Please sign in to comment.