Fixed #12228 (GUI: Compliance report for Misra C 2012 is not working properly) (#5709)

This commit is contained in:
Daniel Marjamäki 2023-11-29 16:13:01 +01:00 committed by GitHub
parent db66105128
commit 9dd729e9be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 2 deletions

View File

@ -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()
@ -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);
@ -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();
}
}