GUI: configuration of premium features
This commit is contained in:
parent
1262c98416
commit
5d267000e2
|
@ -946,6 +946,20 @@ Settings MainWindow::getCppcheckSettings()
|
||||||
json += " }";
|
json += " }";
|
||||||
result.addons.push_back(json.toStdString());
|
result.addons.push_back(json.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isCppcheckPremium()) {
|
||||||
|
QString premiumArgs;
|
||||||
|
if (mProjectFile->getBughunting())
|
||||||
|
premiumArgs += " --bughunting";
|
||||||
|
if (mProjectFile->getCertIntPrecision() > 0)
|
||||||
|
premiumArgs += " --cert-c-int-precision=" + QString::number(mProjectFile->getCertIntPrecision());
|
||||||
|
if (mProjectFile->getAddons().contains("misra"))
|
||||||
|
premiumArgs += " --misra-c-2012";
|
||||||
|
for (const QString& c: mProjectFile->getCodingStandards()) {
|
||||||
|
premiumArgs += " --" + c;
|
||||||
|
}
|
||||||
|
result.premiumArgs = premiumArgs.mid(1).toStdString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include directories (and files) are searched in listed order.
|
// Include directories (and files) are searched in listed order.
|
||||||
|
@ -1664,7 +1678,7 @@ void MainWindow::newProjectFile()
|
||||||
mProjectFile->setFilename(filepath);
|
mProjectFile->setFilename(filepath);
|
||||||
mProjectFile->setBuildDir(filename.left(filename.indexOf(".")) + "-cppcheck-build-dir");
|
mProjectFile->setBuildDir(filename.left(filename.indexOf(".")) + "-cppcheck-build-dir");
|
||||||
|
|
||||||
ProjectFileDialog dlg(mProjectFile, this);
|
ProjectFileDialog dlg(mProjectFile, isCppcheckPremium(), this);
|
||||||
if (dlg.exec() == QDialog::Accepted) {
|
if (dlg.exec() == QDialog::Accepted) {
|
||||||
addProjectMRU(filepath);
|
addProjectMRU(filepath);
|
||||||
analyzeProject(mProjectFile);
|
analyzeProject(mProjectFile);
|
||||||
|
@ -1695,7 +1709,7 @@ void MainWindow::editProjectFile()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectFileDialog dlg(mProjectFile, this);
|
ProjectFileDialog dlg(mProjectFile, isCppcheckPremium(), this);
|
||||||
if (dlg.exec() == QDialog::Accepted) {
|
if (dlg.exec() == QDialog::Accepted) {
|
||||||
mProjectFile->write();
|
mProjectFile->write();
|
||||||
analyzeProject(mProjectFile);
|
analyzeProject(mProjectFile);
|
||||||
|
@ -1864,3 +1878,7 @@ void MainWindow::suppressIds(QStringList ids)
|
||||||
mProjectFile->setSuppressions(suppressions);
|
mProjectFile->setSuppressions(suppressions);
|
||||||
mProjectFile->write();
|
mProjectFile->write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MainWindow::isCppcheckPremium() const {
|
||||||
|
return mCppcheckCfgProductName.startsWith("Cppcheck Premium ");
|
||||||
|
}
|
||||||
|
|
|
@ -230,6 +230,8 @@ protected slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
bool isCppcheckPremium() const;
|
||||||
|
|
||||||
/** Get filename for last results */
|
/** Get filename for last results */
|
||||||
QString getLastResults() const;
|
QString getLastResults() const;
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,11 @@ void ProjectFile::clear()
|
||||||
mVsConfigurations.clear();
|
mVsConfigurations.clear();
|
||||||
mTags.clear();
|
mTags.clear();
|
||||||
mWarningTags.clear();
|
mWarningTags.clear();
|
||||||
|
|
||||||
|
// Premium
|
||||||
|
mBughunting = false;
|
||||||
|
mCertIntPrecision = 0;
|
||||||
|
mCodingStandards.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProjectFile::read(const QString &filename)
|
bool ProjectFile::read(const QString &filename)
|
||||||
|
@ -195,6 +200,15 @@ bool ProjectFile::read(const QString &filename)
|
||||||
// VSConfiguration
|
// VSConfiguration
|
||||||
if (xmlReader.name() == QString(CppcheckXml::VSConfigurationElementName))
|
if (xmlReader.name() == QString(CppcheckXml::VSConfigurationElementName))
|
||||||
readVsConfigurations(xmlReader);
|
readVsConfigurations(xmlReader);
|
||||||
|
|
||||||
|
// Cppcheck Premium
|
||||||
|
if (xmlReader.name() == QString(CppcheckXml::BughuntingElementName))
|
||||||
|
mBughunting = true;
|
||||||
|
if (xmlReader.name() == QString(CppcheckXml::CodingStandardsElementName))
|
||||||
|
readStringList(mAddons, xmlReader, CppcheckXml::CodingStandardElementName);
|
||||||
|
if (xmlReader.name() == QString(CppcheckXml::CertIntPrecisionElementName))
|
||||||
|
mCertIntPrecision = readInt(xmlReader, 0);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QXmlStreamReader::EndElement:
|
case QXmlStreamReader::EndElement:
|
||||||
|
@ -928,6 +942,23 @@ bool ProjectFile::write(const QString &filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cppcheck Premium
|
||||||
|
if (mBughunting) {
|
||||||
|
xmlWriter.writeStartElement(CppcheckXml::BughuntingElementName);
|
||||||
|
xmlWriter.writeEndElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
writeStringList(xmlWriter,
|
||||||
|
mCodingStandards,
|
||||||
|
CppcheckXml::CodingStandardsElementName,
|
||||||
|
CppcheckXml::CodingStandardElementName);
|
||||||
|
|
||||||
|
if (mCertIntPrecision > 0) {
|
||||||
|
xmlWriter.writeStartElement(CppcheckXml::CertIntPrecisionElementName);
|
||||||
|
xmlWriter.writeCharacters(QString::number(mCertIntPrecision));
|
||||||
|
xmlWriter.writeEndElement();
|
||||||
|
}
|
||||||
|
|
||||||
xmlWriter.writeEndDocument();
|
xmlWriter.writeEndDocument();
|
||||||
file.close();
|
file.close();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -333,6 +333,36 @@ public:
|
||||||
/** Get tags for a warning */
|
/** Get tags for a warning */
|
||||||
QString getWarningTags(std::size_t hash) const;
|
QString getWarningTags(std::size_t hash) const;
|
||||||
|
|
||||||
|
/** Bughunting (Cppcheck Premium) */
|
||||||
|
void setBughunting(bool bughunting) {
|
||||||
|
mBughunting = bughunting;
|
||||||
|
}
|
||||||
|
bool getBughunting() const {
|
||||||
|
return mBughunting;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @brief Get list of coding standards (checked by Cppcheck Premium). */
|
||||||
|
QStringList getCodingStandards() const {
|
||||||
|
return mCodingStandards;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set list of coding standards (checked by Cppcheck Premium).
|
||||||
|
* @param codingStandards List of coding standards.
|
||||||
|
*/
|
||||||
|
void setCodingStandards(QStringList codingStandards) {
|
||||||
|
mCodingStandards = std::move(codingStandards);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Cert C: int precision */
|
||||||
|
void setCertIntPrecision(int p) {
|
||||||
|
mCertIntPrecision = p;
|
||||||
|
}
|
||||||
|
int getCertIntPrecision() const {
|
||||||
|
return mCertIntPrecision;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Write project file (to disk).
|
* @brief Write project file (to disk).
|
||||||
* @param filename Filename to use.
|
* @param filename Filename to use.
|
||||||
|
@ -543,6 +573,15 @@ private:
|
||||||
*/
|
*/
|
||||||
QStringList mAddons;
|
QStringList mAddons;
|
||||||
|
|
||||||
|
bool mBughunting;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief List of coding standards, checked by Cppcheck Premium.
|
||||||
|
*/
|
||||||
|
QStringList mCodingStandards;
|
||||||
|
|
||||||
|
int mCertIntPrecision;
|
||||||
|
|
||||||
/** @brief Execute clang analyzer? */
|
/** @brief Execute clang analyzer? */
|
||||||
bool mClangAnalyzer;
|
bool mClangAnalyzer;
|
||||||
|
|
||||||
|
|
|
@ -773,24 +773,26 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QGroupBox" name="groupBox_12">
|
||||||
<property name="text">
|
<property name="title">
|
||||||
<string>Coding standards</string>
|
<string>Coding standards</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<layout class="QVBoxLayout" name="verticalLayout_20">
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="mAddonMisra">
|
<widget class="QCheckBox" name="mMisraC2012">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>MISRA C 2012</string>
|
<string>Misra C 2012</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
<layout class="QHBoxLayout" name="mLayoutMisraRuleTexts">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="mLabelMisraFile">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>MISRA rule texts</string>
|
<string>MISRA rule texts</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -812,6 +814,57 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="mPremiumCertC">
|
||||||
|
<property name="text">
|
||||||
|
<string>Cert C</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="mLabelCertIntPrecision">
|
||||||
|
<property name="text">
|
||||||
|
<string>CERT-INT35-C: int precision (if size equals precision, you can leave empty)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="mEditCertIntPrecision"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="mMisraCpp2008">
|
||||||
|
<property name="text">
|
||||||
|
<string>Misra C++ 2008</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="mAutosar">
|
||||||
|
<property name="text">
|
||||||
|
<string>Autosar</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="mGroupboxBughunting">
|
||||||
|
<property name="title">
|
||||||
|
<string>Bug hunting</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_21">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="mBughunting">
|
||||||
|
<property name="text">
|
||||||
|
<string>Bug hunting</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -40,6 +40,11 @@
|
||||||
#include <QRegularExpressionValidator>
|
#include <QRegularExpressionValidator>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
|
static const char ADDON_MISRA[] = "misra";
|
||||||
|
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_AUTOSAR[] = "autosar";
|
||||||
|
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
|
|
||||||
/** Return paths from QListWidget */
|
/** Return paths from QListWidget */
|
||||||
|
@ -79,10 +84,11 @@ QStringList ProjectFileDialog::getProjectConfigs(const QString &fileName)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectFileDialog::ProjectFileDialog(ProjectFile *projectFile, QWidget *parent)
|
ProjectFileDialog::ProjectFileDialog(ProjectFile *projectFile, bool premium, QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
, mUI(new Ui::ProjectFile)
|
, mUI(new Ui::ProjectFile)
|
||||||
, mProjectFile(projectFile)
|
, mProjectFile(projectFile)
|
||||||
|
, mPremium(premium)
|
||||||
{
|
{
|
||||||
mUI->setupUi(this);
|
mUI->setupUi(this);
|
||||||
|
|
||||||
|
@ -191,6 +197,9 @@ ProjectFileDialog::ProjectFileDialog(ProjectFile *projectFile, QWidget *parent)
|
||||||
platformFiles.sort();
|
platformFiles.sort();
|
||||||
mUI->mComboBoxPlatform->addItems(platformFiles);
|
mUI->mComboBoxPlatform->addItems(platformFiles);
|
||||||
|
|
||||||
|
// integer. allow empty.
|
||||||
|
mUI->mEditCertIntPrecision->setValidator(new QRegularExpressionValidator(QRegularExpression("[0-9]*"),this));
|
||||||
|
|
||||||
mUI->mEditTags->setValidator(new QRegularExpressionValidator(QRegularExpression("[a-zA-Z0-9 ;]*"),this));
|
mUI->mEditTags->setValidator(new QRegularExpressionValidator(QRegularExpression("[a-zA-Z0-9 ;]*"),this));
|
||||||
|
|
||||||
const QRegularExpression undefRegExp("\\s*([a-zA-Z_][a-zA-Z0-9_]*[; ]*)*");
|
const QRegularExpression undefRegExp("\\s*([a-zA-Z_][a-zA-Z0-9_]*[; ]*)*");
|
||||||
|
@ -340,15 +349,36 @@ 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");
|
||||||
updateAddonCheckBox(mUI->mAddonMisra, projectFile, dataDir, "misra");
|
updateAddonCheckBox(mUI->mMisraC2012, projectFile, dataDir, ADDON_MISRA);
|
||||||
|
|
||||||
const QString &misraFile = settings.value(SETTINGS_MISRA_FILE, QString()).toString();
|
const QString &misraFile = settings.value(SETTINGS_MISRA_FILE, QString()).toString();
|
||||||
mUI->mEditMisraFile->setText(misraFile);
|
mUI->mEditMisraFile->setText(misraFile);
|
||||||
if (!mUI->mAddonMisra->isEnabled()) {
|
if (mPremium) {
|
||||||
|
mUI->mLabelMisraFile->setVisible(false);
|
||||||
|
mUI->mEditMisraFile->setVisible(false);
|
||||||
|
mUI->mBtnBrowseMisraFile->setVisible(false);
|
||||||
|
} else if (!mUI->mMisraC2012->isEnabled()) {
|
||||||
mUI->mEditMisraFile->setEnabled(false);
|
mUI->mEditMisraFile->setEnabled(false);
|
||||||
mUI->mBtnBrowseMisraFile->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)
|
||||||
|
mUI->mEditCertIntPrecision->setText(QString());
|
||||||
|
else
|
||||||
|
mUI->mEditCertIntPrecision->setText(QString::number(projectFile->getCertIntPrecision()));
|
||||||
|
|
||||||
|
mUI->mPremiumCertC->setVisible(mPremium);
|
||||||
|
mUI->mMisraCpp2008->setVisible(mPremium);
|
||||||
|
mUI->mAutosar->setVisible(mPremium);
|
||||||
|
mUI->mLabelCertIntPrecision->setVisible(mPremium);
|
||||||
|
mUI->mEditCertIntPrecision->setVisible(mPremium);
|
||||||
|
mUI->mBughunting->setChecked(projectFile->getBughunting());
|
||||||
|
mUI->mGroupboxBughunting->setVisible(mPremium);
|
||||||
|
|
||||||
mUI->mToolClangAnalyzer->setChecked(projectFile->getClangAnalyzer());
|
mUI->mToolClangAnalyzer->setChecked(projectFile->getClangAnalyzer());
|
||||||
mUI->mToolClangTidy->setChecked(projectFile->getClangTidy());
|
mUI->mToolClangTidy->setChecked(projectFile->getClangTidy());
|
||||||
if (CheckThread::clangTidyCmd().isEmpty()) {
|
if (CheckThread::clangTidyCmd().isEmpty()) {
|
||||||
|
@ -405,14 +435,23 @@ void ProjectFileDialog::saveToProjectFile(ProjectFile *projectFile) const
|
||||||
projectFile->setSafeChecks(safeChecks);
|
projectFile->setSafeChecks(safeChecks);
|
||||||
*/
|
*/
|
||||||
// Addons
|
// Addons
|
||||||
QStringList list;
|
QStringList addons;
|
||||||
if (mUI->mAddonThreadSafety->isChecked())
|
if (mUI->mAddonThreadSafety->isChecked())
|
||||||
list << "threadsafety";
|
addons << "threadsafety";
|
||||||
if (mUI->mAddonY2038->isChecked())
|
if (mUI->mAddonY2038->isChecked())
|
||||||
list << "y2038";
|
addons << "y2038";
|
||||||
if (mUI->mAddonMisra->isChecked())
|
if (mUI->mMisraC2012->isChecked())
|
||||||
list << "misra";
|
addons << ADDON_MISRA;
|
||||||
projectFile->setAddons(list);
|
projectFile->setAddons(addons);
|
||||||
|
QStringList codingStandards;
|
||||||
|
if (mUI->mPremiumCertC->isChecked())
|
||||||
|
codingStandards << CODING_STANDARD_CERT_C;
|
||||||
|
if (mUI->mMisraCpp2008->isChecked())
|
||||||
|
codingStandards << CODING_STANDARD_MISRA_CPP_2008;
|
||||||
|
if (mUI->mAutosar->isChecked())
|
||||||
|
codingStandards << CODING_STANDARD_AUTOSAR;
|
||||||
|
projectFile->setCodingStandards(codingStandards);
|
||||||
|
projectFile->setCertIntPrecision(mUI->mEditCertIntPrecision->text().toInt());
|
||||||
projectFile->setClangAnalyzer(mUI->mToolClangAnalyzer->isChecked());
|
projectFile->setClangAnalyzer(mUI->mToolClangAnalyzer->isChecked());
|
||||||
projectFile->setClangTidy(mUI->mToolClangTidy->isChecked());
|
projectFile->setClangTidy(mUI->mToolClangTidy->isChecked());
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
@ -874,8 +913,8 @@ void ProjectFileDialog::browseMisraFile()
|
||||||
mUI->mEditMisraFile->setText(fileName);
|
mUI->mEditMisraFile->setText(fileName);
|
||||||
settings.setValue(SETTINGS_MISRA_FILE, fileName);
|
settings.setValue(SETTINGS_MISRA_FILE, fileName);
|
||||||
|
|
||||||
mUI->mAddonMisra->setText("MISRA C 2012");
|
mUI->mMisraC2012->setText("MISRA C 2012");
|
||||||
mUI->mAddonMisra->setEnabled(true);
|
mUI->mMisraC2012->setEnabled(true);
|
||||||
updateAddonCheckBox(mUI->mAddonMisra, nullptr, getDataDir(), "misra");
|
updateAddonCheckBox(mUI->mMisraC2012, nullptr, getDataDir(), ADDON_MISRA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ class ProjectFile;
|
||||||
class ProjectFileDialog : public QDialog {
|
class ProjectFileDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ProjectFileDialog(ProjectFile *projectFile, QWidget *parent = nullptr);
|
explicit ProjectFileDialog(ProjectFile *projectFile, bool premium, QWidget *parent = nullptr);
|
||||||
~ProjectFileDialog() override;
|
~ProjectFileDialog() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -325,6 +325,9 @@ private:
|
||||||
*/
|
*/
|
||||||
ProjectFile *mProjectFile;
|
ProjectFile *mProjectFile;
|
||||||
|
|
||||||
|
/** Is this Cppcheck Premium? */
|
||||||
|
bool mPremium;
|
||||||
|
|
||||||
QString getExistingDirectory(const QString &caption, bool trailingSlash);
|
QString getExistingDirectory(const QString &caption, bool trailingSlash);
|
||||||
|
|
||||||
QList<Suppressions::Suppression> mSuppressions;
|
QList<Suppressions::Suppression> mSuppressions;
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace {
|
||||||
std::string args; // special extra arguments
|
std::string args; // special extra arguments
|
||||||
std::string python; // script interpreter
|
std::string python; // script interpreter
|
||||||
bool ctu = false;
|
bool ctu = false;
|
||||||
std::string runScript{};
|
std::string runScript;
|
||||||
|
|
||||||
static std::string getFullPath(const std::string &fileName, const std::string &exename) {
|
static std::string getFullPath(const std::string &fileName, const std::string &exename) {
|
||||||
if (Path::fileExists(fileName))
|
if (Path::fileExists(fileName))
|
||||||
|
@ -275,6 +275,7 @@ static void createDumpFile(const Settings& settings,
|
||||||
static std::string executeAddon(const AddonInfo &addonInfo,
|
static std::string executeAddon(const AddonInfo &addonInfo,
|
||||||
const std::string &defaultPythonExe,
|
const std::string &defaultPythonExe,
|
||||||
const std::string &file,
|
const std::string &file,
|
||||||
|
const std::string &premiumArgs,
|
||||||
std::function<bool(std::string,std::vector<std::string>,std::string,std::string*)> executeCommand)
|
std::function<bool(std::string,std::vector<std::string>,std::string,std::string*)> executeCommand)
|
||||||
{
|
{
|
||||||
const std::string redirect = "2>&1";
|
const std::string redirect = "2>&1";
|
||||||
|
@ -308,6 +309,8 @@ static std::string executeAddon(const AddonInfo &addonInfo,
|
||||||
if (addonInfo.executable.empty())
|
if (addonInfo.executable.empty())
|
||||||
args = cmdFileName(addonInfo.runScript) + " " + cmdFileName(addonInfo.scriptFile);
|
args = cmdFileName(addonInfo.runScript) + " " + cmdFileName(addonInfo.scriptFile);
|
||||||
args += std::string(args.empty() ? "" : " ") + "--cli" + addonInfo.args;
|
args += std::string(args.empty() ? "" : " ") + "--cli" + addonInfo.args;
|
||||||
|
if (!premiumArgs.empty() && !addonInfo.executable.empty())
|
||||||
|
args += " " + premiumArgs;
|
||||||
|
|
||||||
const std::string fileArg = (endsWith(file, FILELIST, sizeof(FILELIST)-1) ? " --file-list " : " ") + cmdFileName(file);
|
const std::string fileArg = (endsWith(file, FILELIST, sizeof(FILELIST)-1) ? " --file-list " : " ") + cmdFileName(file);
|
||||||
args += fileArg;
|
args += fileArg;
|
||||||
|
@ -1366,7 +1369,7 @@ void CppCheck::executeAddons(const std::vector<std::string>& files)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const std::string results =
|
const std::string results =
|
||||||
executeAddon(addonInfo, mSettings.addonPython, fileList.empty() ? files[0] : fileList, mExecuteCommand);
|
executeAddon(addonInfo, mSettings.addonPython, fileList.empty() ? files[0] : fileList, mSettings.premiumArgs, mExecuteCommand);
|
||||||
std::istringstream istr(results);
|
std::istringstream istr(results);
|
||||||
std::string line;
|
std::string line;
|
||||||
|
|
||||||
|
|
|
@ -178,6 +178,11 @@ namespace CppcheckXml {
|
||||||
const char Name[] = "name";
|
const char Name[] = "name";
|
||||||
const char VSConfigurationElementName[] = "vs-configurations";
|
const char VSConfigurationElementName[] = "vs-configurations";
|
||||||
const char VSConfigurationName[] = "config";
|
const char VSConfigurationName[] = "config";
|
||||||
|
// Cppcheck Premium
|
||||||
|
const char BughuntingElementName[] = "bug-hunting";
|
||||||
|
const char CodingStandardsElementName[] = "coding-standards";
|
||||||
|
const char CodingStandardElementName[] = "coding-standard";
|
||||||
|
const char CertIntPrecisionElementName[] = "cert-c-int-precision";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
|
@ -239,6 +239,9 @@ public:
|
||||||
/** @brief plist output (--plist-output=<dir>) */
|
/** @brief plist output (--plist-output=<dir>) */
|
||||||
std::string plistOutput;
|
std::string plistOutput;
|
||||||
|
|
||||||
|
/** @brief Extra arguments for Cppcheck Premium addon */
|
||||||
|
std::string premiumArgs;
|
||||||
|
|
||||||
/** @brief Using -E for debugging purposes */
|
/** @brief Using -E for debugging purposes */
|
||||||
bool preprocessOnly;
|
bool preprocessOnly;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue