Skip to content

Commit

Permalink
Fixed #12369 (GUI: Compliance report for Misra C++ 2008) (#5900)
Browse files Browse the repository at this point in the history
  • Loading branch information
danmar authored Jan 20, 2024
1 parent d0a02bb commit b959c11
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
16 changes: 6 additions & 10 deletions gui/compliancereportdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,13 @@ ComplianceReportDialog::ComplianceReportDialog(ProjectFile* projectFile, QString
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"))
if (!projectFile->getCodingStandards().contains("misra-c-2023") && 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());
for (QString std: projectFile->getCodingStandards()) {
std[0] = std[0].toUpper();
std = std.replace("-", " ").replace(" c ", " C ").replace(" cpp ", " C++ ").replace(" c++ ", " C++ ");
mUI->mCodingStandard->addItem(std);
}
}

ComplianceReportDialog::~ComplianceReportDialog()
Expand Down
2 changes: 1 addition & 1 deletion gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,7 @@ void MainWindow::enableCheckButtons(bool enable)
mUI->mActionAnalyzeDirectory->setEnabled(enable);

if (isCppcheckPremium()) {
mUI->mActionComplianceReport->setEnabled(enable && mProjectFile && mProjectFile->getAddons().contains("misra"));
mUI->mActionComplianceReport->setEnabled(enable && mProjectFile && (mProjectFile->getAddons().contains("misra") || !mProjectFile->getCodingStandards().empty()));
}
}

Expand Down

0 comments on commit b959c11

Please sign in to comment.