Skip to content

Commit

Permalink
Fixed #12228 (GUI: Compliance report for Misra C 2012 is not working …
Browse files Browse the repository at this point in the history
…properly) (#5709)
  • Loading branch information
danmar authored Nov 29, 2023
1 parent db66105 commit 9dd729e
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions gui/compliancereportdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,18 @@ ComplianceReportDialog::ComplianceReportDialog(ProjectFile* projectFile, QString
mUI->setupUi(this);
mUI->mEditProjectName->setText(projectFile->getProjectName());
connect(mUI->buttonBox, &QDialogButtonBox::clicked, this, &ComplianceReportDialog::buttonClicked);
mUI->mCodingStandard->clear();
if (projectFile->getCodingStandards().contains("misra-c-2023"))
mUI->mCodingStandard->addItem("Misra C 2023");
else if (projectFile->getAddons().contains("misra"))
mUI->mCodingStandard->addItem("Misra C 2012");
if (projectFile->getCodingStandards().contains("misra-c++-2008"))
mUI->mCodingStandard->addItem("Misra C++ 2008");
if (projectFile->getCodingStandards().contains("cert-c-2016"))
mUI->mCodingStandard->addItem("Cert C");
if (projectFile->getCodingStandards().contains("cert-c++-2016"))
mUI->mCodingStandard->addItem("Cert C++");
mUI->mCodingStandard->addItems(projectFile->getCodingStandards());
}

ComplianceReportDialog::~ComplianceReportDialog()
Expand Down Expand Up @@ -197,8 +209,9 @@ void ComplianceReportDialog::save()

QStringList args{"--project-name=" + projectName,
"--project-version=" + projectVersion,
"--output-file=" + outFile,
"--suppressions=" + suppressions.join(",")};
"--output-file=" + outFile};
if (!suppressions.isEmpty())
args << "--suppressions=" + suppressions.join(",");

args << ("--" + std);

Expand All @@ -215,4 +228,13 @@ void ComplianceReportDialog::save()
process.start(appPath + "/compliance-report", args);
#endif
process.waitForFinished();
const QString output = process.readAll();
if (!output.isEmpty()) {
QMessageBox msg(QMessageBox::Critical,
tr("Save compliance report"),
output,
QMessageBox::Ok,
this);
msg.exec();
}
}

0 comments on commit 9dd729e

Please sign in to comment.