GUI: only run misra addon in premium version. remove misra rule texts configuration that is not needed in premium.
This commit is contained in:
parent
3c21b9cc53
commit
2c53b73e1b
|
@ -80,7 +80,6 @@
|
||||||
#define SETTINGS_LANGUAGE "Application language"
|
#define SETTINGS_LANGUAGE "Application language"
|
||||||
#define SETTINGS_GLOBAL_INCLUDE_PATHS "Global include paths"
|
#define SETTINGS_GLOBAL_INCLUDE_PATHS "Global include paths"
|
||||||
#define SETTINGS_PYTHON_PATH "Python path"
|
#define SETTINGS_PYTHON_PATH "Python path"
|
||||||
#define SETTINGS_MISRA_FILE "MISRA C 2012 file"
|
|
||||||
#define SETTINGS_CLANG_PATH "Clang path"
|
#define SETTINGS_CLANG_PATH "Clang path"
|
||||||
#define SETTINGS_VS_INCLUDE_PATHS "VS include paths"
|
#define SETTINGS_VS_INCLUDE_PATHS "VS include paths"
|
||||||
#define SETTINGS_INLINE_SUPPRESSIONS "Inline suppressions"
|
#define SETTINGS_INLINE_SUPPRESSIONS "Inline suppressions"
|
||||||
|
|
|
@ -971,15 +971,6 @@ Settings MainWindow::getCppcheckSettings()
|
||||||
json += "{ \"script\":\"" + addonFilePath + "\"";
|
json += "{ \"script\":\"" + addonFilePath + "\"";
|
||||||
if (!pythonCmd.isEmpty())
|
if (!pythonCmd.isEmpty())
|
||||||
json += ", \"python\":\"" + pythonCmd + "\"";
|
json += ", \"python\":\"" + pythonCmd + "\"";
|
||||||
QString misraFile = fromNativePath(mSettings->value(SETTINGS_MISRA_FILE).toString());
|
|
||||||
if (addon == "misra" && !misraFile.isEmpty()) {
|
|
||||||
QString arg;
|
|
||||||
if (misraFile.endsWith(".pdf", Qt::CaseInsensitive))
|
|
||||||
arg = "--misra-pdf=" + misraFile;
|
|
||||||
else
|
|
||||||
arg = "--rule-texts=" + misraFile;
|
|
||||||
json += ", \"args\":[\"" + arg + "\"]";
|
|
||||||
}
|
|
||||||
json += " }";
|
json += " }";
|
||||||
result.addons.emplace(json.toStdString());
|
result.addons.emplace(json.toStdString());
|
||||||
}
|
}
|
||||||
|
@ -1923,8 +1914,11 @@ static int getVersion(const QString& nameWithVersion) {
|
||||||
for (const auto c: nameWithVersion) {
|
for (const auto c: nameWithVersion) {
|
||||||
if (c == '\n' || c == '\r')
|
if (c == '\n' || c == '\r')
|
||||||
break;
|
break;
|
||||||
else if (c == ' ')
|
else if (c == ' ') {
|
||||||
|
if (ret > 0 && dot == 1 && nameWithVersion.endsWith(" dev"))
|
||||||
|
return ret * 1000000 + v * 1000 + 500;
|
||||||
dot = ret = v = 0;
|
dot = ret = v = 0;
|
||||||
|
}
|
||||||
else if (c == '.') {
|
else if (c == '.') {
|
||||||
++dot;
|
++dot;
|
||||||
ret = ret * 1000 + v;
|
ret = ret * 1000 + v;
|
||||||
|
|
|
@ -779,7 +779,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_12">
|
<widget class="QGroupBox" name="groupBox_12">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Coding standards</string>
|
<string>Coding standards (Premium)</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_20">
|
<layout class="QVBoxLayout" name="verticalLayout_20">
|
||||||
<item>
|
<item>
|
||||||
|
@ -790,32 +790,14 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="mLayoutMisraRuleTexts">
|
<widget class="QCheckBox" name="mMisraCpp2008">
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="mLabelMisraFile">
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>MISRA rule texts</string>
|
<string>Misra C++ 2008</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="mEditMisraFile">
|
<widget class="QCheckBox" name="mCertC2016">
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="mBtnBrowseMisraFile">
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="mPremiumCertC">
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Cert C</string>
|
<string>Cert C</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -836,9 +818,9 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="mMisraCpp2008">
|
<widget class="QCheckBox" name="mCertCpp2016">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Misra C++ 2008</string>
|
<string>Cert C++</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -855,7 +837,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="mGroupboxBughunting">
|
<widget class="QGroupBox" name="mGroupboxBughunting">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Bug hunting</string>
|
<string>Bug hunting (Premium)</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_21">
|
<layout class="QVBoxLayout" name="verticalLayout_21">
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
static const char ADDON_MISRA[] = "misra";
|
static const char ADDON_MISRA[] = "misra";
|
||||||
static const char CODING_STANDARD_MISRA_CPP_2008[] = "misra-cpp-2008";
|
static const char CODING_STANDARD_MISRA_CPP_2008[] = "misra-cpp-2008";
|
||||||
static const char CODING_STANDARD_CERT_C[] = "cert-c-2016";
|
static const char CODING_STANDARD_CERT_C[] = "cert-c-2016";
|
||||||
|
static const char CODING_STANDARD_CERT_CPP[] = "cert-cpp-2016";
|
||||||
static const char CODING_STANDARD_AUTOSAR[] = "autosar";
|
static const char CODING_STANDARD_AUTOSAR[] = "autosar";
|
||||||
|
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
|
@ -224,7 +225,6 @@ ProjectFileDialog::ProjectFileDialog(ProjectFile *projectFile, bool premium, QWi
|
||||||
connect(mUI->mBtnAddSuppression, &QPushButton::clicked, this, &ProjectFileDialog::addSuppression);
|
connect(mUI->mBtnAddSuppression, &QPushButton::clicked, this, &ProjectFileDialog::addSuppression);
|
||||||
connect(mUI->mBtnRemoveSuppression, &QPushButton::clicked, this, &ProjectFileDialog::removeSuppression);
|
connect(mUI->mBtnRemoveSuppression, &QPushButton::clicked, this, &ProjectFileDialog::removeSuppression);
|
||||||
connect(mUI->mListSuppressions, &QListWidget::doubleClicked, this, &ProjectFileDialog::editSuppression);
|
connect(mUI->mListSuppressions, &QListWidget::doubleClicked, this, &ProjectFileDialog::editSuppression);
|
||||||
connect(mUI->mBtnBrowseMisraFile, &QPushButton::clicked, this, &ProjectFileDialog::browseMisraFile);
|
|
||||||
connect(mUI->mChkAllVsConfigs, &QCheckBox::clicked, this, &ProjectFileDialog::checkAllVSConfigs);
|
connect(mUI->mChkAllVsConfigs, &QCheckBox::clicked, this, &ProjectFileDialog::checkAllVSConfigs);
|
||||||
loadFromProjectFile(projectFile);
|
loadFromProjectFile(projectFile);
|
||||||
}
|
}
|
||||||
|
@ -349,35 +349,30 @@ void ProjectFileDialog::loadFromProjectFile(const ProjectFile *projectFile)
|
||||||
const QString dataDir = getDataDir();
|
const QString dataDir = getDataDir();
|
||||||
updateAddonCheckBox(mUI->mAddonThreadSafety, projectFile, dataDir, "threadsafety");
|
updateAddonCheckBox(mUI->mAddonThreadSafety, projectFile, dataDir, "threadsafety");
|
||||||
updateAddonCheckBox(mUI->mAddonY2038, projectFile, dataDir, "y2038");
|
updateAddonCheckBox(mUI->mAddonY2038, projectFile, dataDir, "y2038");
|
||||||
|
|
||||||
|
if (mPremium)
|
||||||
updateAddonCheckBox(mUI->mMisraC2012, projectFile, dataDir, ADDON_MISRA);
|
updateAddonCheckBox(mUI->mMisraC2012, projectFile, dataDir, ADDON_MISRA);
|
||||||
|
else
|
||||||
const QString &misraFile = settings.value(SETTINGS_MISRA_FILE, QString()).toString();
|
mUI->mMisraC2012->setChecked(false);
|
||||||
mUI->mEditMisraFile->setText(misraFile);
|
mUI->mCertC2016->setChecked(mPremium && projectFile->getCodingStandards().contains(CODING_STANDARD_CERT_C));
|
||||||
if (mPremium) {
|
mUI->mCertCpp2016->setChecked(mPremium && projectFile->getCodingStandards().contains(CODING_STANDARD_CERT_CPP));
|
||||||
mUI->mLabelMisraFile->setVisible(false);
|
mUI->mMisraCpp2008->setChecked(mPremium && projectFile->getCodingStandards().contains(CODING_STANDARD_MISRA_CPP_2008));
|
||||||
mUI->mEditMisraFile->setVisible(false);
|
mUI->mAutosar->setChecked(mPremium && projectFile->getCodingStandards().contains(CODING_STANDARD_AUTOSAR));
|
||||||
mUI->mBtnBrowseMisraFile->setVisible(false);
|
|
||||||
} else if (!mUI->mMisraC2012->isEnabled()) {
|
|
||||||
mUI->mEditMisraFile->setEnabled(false);
|
|
||||||
mUI->mBtnBrowseMisraFile->setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
mUI->mPremiumCertC->setChecked(projectFile->getCodingStandards().contains(CODING_STANDARD_CERT_C));
|
|
||||||
mUI->mMisraCpp2008->setChecked(projectFile->getCodingStandards().contains(CODING_STANDARD_MISRA_CPP_2008));
|
|
||||||
mUI->mAutosar->setChecked(projectFile->getCodingStandards().contains(CODING_STANDARD_AUTOSAR));
|
|
||||||
|
|
||||||
if (projectFile->getCertIntPrecision() <= 0)
|
if (projectFile->getCertIntPrecision() <= 0)
|
||||||
mUI->mEditCertIntPrecision->setText(QString());
|
mUI->mEditCertIntPrecision->setText(QString());
|
||||||
else
|
else
|
||||||
mUI->mEditCertIntPrecision->setText(QString::number(projectFile->getCertIntPrecision()));
|
mUI->mEditCertIntPrecision->setText(QString::number(projectFile->getCertIntPrecision()));
|
||||||
|
|
||||||
mUI->mPremiumCertC->setVisible(mPremium);
|
mUI->mMisraC2012->setEnabled(mPremium);
|
||||||
mUI->mMisraCpp2008->setVisible(mPremium);
|
mUI->mMisraCpp2008->setEnabled(mPremium);
|
||||||
mUI->mAutosar->setVisible(mPremium);
|
mUI->mCertC2016->setEnabled(mPremium);
|
||||||
|
mUI->mCertCpp2016->setEnabled(mPremium);
|
||||||
|
mUI->mAutosar->setEnabled(mPremium);
|
||||||
mUI->mLabelCertIntPrecision->setVisible(mPremium);
|
mUI->mLabelCertIntPrecision->setVisible(mPremium);
|
||||||
mUI->mEditCertIntPrecision->setVisible(mPremium);
|
mUI->mEditCertIntPrecision->setVisible(mPremium);
|
||||||
mUI->mBughunting->setChecked(projectFile->getBughunting());
|
mUI->mBughunting->setChecked(mPremium && projectFile->getBughunting());
|
||||||
mUI->mGroupboxBughunting->setVisible(mPremium);
|
mUI->mBughunting->setEnabled(mPremium);
|
||||||
|
|
||||||
mUI->mToolClangAnalyzer->setChecked(projectFile->getClangAnalyzer());
|
mUI->mToolClangAnalyzer->setChecked(projectFile->getClangAnalyzer());
|
||||||
mUI->mToolClangTidy->setChecked(projectFile->getClangTidy());
|
mUI->mToolClangTidy->setChecked(projectFile->getClangTidy());
|
||||||
|
@ -444,8 +439,10 @@ void ProjectFileDialog::saveToProjectFile(ProjectFile *projectFile) const
|
||||||
addons << ADDON_MISRA;
|
addons << ADDON_MISRA;
|
||||||
projectFile->setAddons(addons);
|
projectFile->setAddons(addons);
|
||||||
QStringList codingStandards;
|
QStringList codingStandards;
|
||||||
if (mUI->mPremiumCertC->isChecked())
|
if (mUI->mCertC2016->isChecked())
|
||||||
codingStandards << CODING_STANDARD_CERT_C;
|
codingStandards << CODING_STANDARD_CERT_C;
|
||||||
|
if (mUI->mCertCpp2016->isChecked())
|
||||||
|
codingStandards << CODING_STANDARD_CERT_CPP;
|
||||||
if (mUI->mMisraCpp2008->isChecked())
|
if (mUI->mMisraCpp2008->isChecked())
|
||||||
codingStandards << CODING_STANDARD_MISRA_CPP_2008;
|
codingStandards << CODING_STANDARD_MISRA_CPP_2008;
|
||||||
if (mUI->mAutosar->isChecked())
|
if (mUI->mAutosar->isChecked())
|
||||||
|
@ -902,20 +899,3 @@ int ProjectFileDialog::getSuppressionIndex(const QString &shortText) const
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFileDialog::browseMisraFile()
|
|
||||||
{
|
|
||||||
const QString fileName = QFileDialog::getOpenFileName(this,
|
|
||||||
tr("Select MISRA rule texts file"),
|
|
||||||
QDir::homePath(),
|
|
||||||
tr("MISRA rule texts file (%1)").arg("*.txt"));
|
|
||||||
if (!fileName.isEmpty()) {
|
|
||||||
QSettings settings;
|
|
||||||
mUI->mEditMisraFile->setText(fileName);
|
|
||||||
settings.setValue(SETTINGS_MISRA_FILE, fileName);
|
|
||||||
|
|
||||||
mUI->mMisraC2012->setText("MISRA C 2012");
|
|
||||||
mUI->mMisraC2012->setEnabled(true);
|
|
||||||
updateAddonCheckBox(mUI->mMisraC2012, nullptr, getDataDir(), ADDON_MISRA);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -267,11 +267,6 @@ protected slots:
|
||||||
*/
|
*/
|
||||||
void editSuppression(const QModelIndex &index);
|
void editSuppression(const QModelIndex &index);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Browse for misra file
|
|
||||||
*/
|
|
||||||
void browseMisraFile();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check for all VS configurations
|
* @brief Check for all VS configurations
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -324,40 +324,6 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_4">
|
|
||||||
<property name="title">
|
|
||||||
<string>MISRA addon</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="text">
|
|
||||||
<string>MISRA rule texts file</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="mEditMisraFile">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>Copy/paste the text from Appendix A &quot;Summary of guidelines&quot; from the MISRA C 2012 pdf to a text file.</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="mBtnBrowseMisraFile">
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_3">
|
<spacer name="verticalSpacer_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
|
@ -65,11 +65,6 @@ SettingsDialog::SettingsDialog(ApplicationList *list,
|
||||||
mUI->mCheckForUpdates->setCheckState(boolToCheckState(settings.value(SETTINGS_CHECK_FOR_UPDATES, false).toBool()));
|
mUI->mCheckForUpdates->setCheckState(boolToCheckState(settings.value(SETTINGS_CHECK_FOR_UPDATES, false).toBool()));
|
||||||
mUI->mEditPythonPath->setText(settings.value(SETTINGS_PYTHON_PATH, QString()).toString());
|
mUI->mEditPythonPath->setText(settings.value(SETTINGS_PYTHON_PATH, QString()).toString());
|
||||||
validateEditPythonPath();
|
validateEditPythonPath();
|
||||||
if (premium)
|
|
||||||
mUI->mEditMisraFile->setVisible(false);
|
|
||||||
else
|
|
||||||
mUI->mEditMisraFile->setText(settings.value(SETTINGS_MISRA_FILE, QString()).toString());
|
|
||||||
mUI->mEditMisraFile->setText(settings.value(SETTINGS_MISRA_FILE, QString()).toString());
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
//mUI->mTabClang->setVisible(true);
|
//mUI->mTabClang->setVisible(true);
|
||||||
|
@ -99,7 +94,6 @@ SettingsDialog::SettingsDialog(ApplicationList *list,
|
||||||
this, SLOT(editApplication()));
|
this, SLOT(editApplication()));
|
||||||
|
|
||||||
connect(mUI->mBtnBrowsePythonPath, &QPushButton::clicked, this, &SettingsDialog::browsePythonPath);
|
connect(mUI->mBtnBrowsePythonPath, &QPushButton::clicked, this, &SettingsDialog::browsePythonPath);
|
||||||
connect(mUI->mBtnBrowseMisraFile, &QPushButton::clicked, this, &SettingsDialog::browseMisraFile);
|
|
||||||
connect(mUI->mBtnEditTheme, SIGNAL(clicked()), this, SLOT(editCodeEditorStyle()));
|
connect(mUI->mBtnEditTheme, SIGNAL(clicked()), this, SLOT(editCodeEditorStyle()));
|
||||||
connect(mUI->mThemeSystem, SIGNAL(released()), this, SLOT(setCodeEditorStyleDefault()));
|
connect(mUI->mThemeSystem, SIGNAL(released()), this, SLOT(setCodeEditorStyleDefault()));
|
||||||
connect(mUI->mThemeDark, SIGNAL(released()), this, SLOT(setCodeEditorStyleDefault()));
|
connect(mUI->mThemeDark, SIGNAL(released()), this, SLOT(setCodeEditorStyleDefault()));
|
||||||
|
@ -191,7 +185,6 @@ void SettingsDialog::saveSettingValues() const
|
||||||
saveCheckboxValue(&settings, mUI->mShowErrorId, SETTINGS_SHOW_ERROR_ID);
|
saveCheckboxValue(&settings, mUI->mShowErrorId, SETTINGS_SHOW_ERROR_ID);
|
||||||
saveCheckboxValue(&settings, mUI->mCheckForUpdates, SETTINGS_CHECK_FOR_UPDATES);
|
saveCheckboxValue(&settings, mUI->mCheckForUpdates, SETTINGS_CHECK_FOR_UPDATES);
|
||||||
settings.setValue(SETTINGS_PYTHON_PATH, mUI->mEditPythonPath->text());
|
settings.setValue(SETTINGS_PYTHON_PATH, mUI->mEditPythonPath->text());
|
||||||
settings.setValue(SETTINGS_MISRA_FILE, mUI->mEditMisraFile->text());
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
settings.setValue(SETTINGS_CLANG_PATH, mUI->mEditClangPath->text());
|
settings.setValue(SETTINGS_CLANG_PATH, mUI->mEditClangPath->text());
|
||||||
|
@ -357,13 +350,6 @@ void SettingsDialog::browsePythonPath()
|
||||||
mUI->mEditPythonPath->setText(fileName);
|
mUI->mEditPythonPath->setText(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::browseMisraFile()
|
|
||||||
{
|
|
||||||
const QString fileName = QFileDialog::getOpenFileName(this, tr("Select MISRA File"), QDir::homePath(), "Misra File (*.pdf *.txt)");
|
|
||||||
if (!fileName.isEmpty())
|
|
||||||
mUI->mEditMisraFile->setText(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Slot to set default light style
|
// Slot to set default light style
|
||||||
void SettingsDialog::setCodeEditorStyleDefault()
|
void SettingsDialog::setCodeEditorStyleDefault()
|
||||||
{
|
{
|
||||||
|
|
|
@ -141,11 +141,6 @@ protected slots:
|
||||||
/** @brief Slot for browsing for the clang binary */
|
/** @brief Slot for browsing for the clang binary */
|
||||||
void browseClangPath();
|
void browseClangPath();
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Browse for MISRA file
|
|
||||||
*/
|
|
||||||
void browseMisraFile();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set Code Editor Style to Default
|
* @brief Set Code Editor Style to Default
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue