parent
b0ce3e4c0c
commit
fb38e87bf4
|
@ -925,8 +925,8 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck, int /*argc*/, const cha
|
|||
++c;
|
||||
if (!settings.quiet)
|
||||
reportStatus(c, settings.project.fileSettings.size(), c, settings.project.fileSettings.size());
|
||||
if(settings.clangTidy)
|
||||
cppcheck.analyseClangTidy(fs);
|
||||
if (settings.clangTidy)
|
||||
cppcheck.analyseClangTidy(fs);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,8 @@ static const cppcheck::Platform::PlatformType builtinPlatforms[] = {
|
|||
|
||||
static const int numberOfBuiltinPlatforms = sizeof(builtinPlatforms) / sizeof(builtinPlatforms[0]);
|
||||
|
||||
QStringList ProjectFileDialog::getProjectConfigs(const QString &fileName) {
|
||||
QStringList ProjectFileDialog::getProjectConfigs(const QString &fileName)
|
||||
{
|
||||
QStringList ret;
|
||||
ImportProject importer;
|
||||
Settings projSettings;
|
||||
|
@ -241,7 +242,7 @@ static void updateAddonCheckBox(QCheckBox *cb, const ProjectFile *projectFile, c
|
|||
|
||||
void ProjectFileDialog::checkAllVSConfigs()
|
||||
{
|
||||
if(mUI.mChkAllVsConfigs->isChecked())
|
||||
if (mUI.mChkAllVsConfigs->isChecked())
|
||||
mUI.mListVsConfigs->selectAll();
|
||||
mUI.mListVsConfigs->setEnabled(!mUI.mChkAllVsConfigs->isChecked());
|
||||
}
|
||||
|
@ -332,15 +333,13 @@ void ProjectFileDialog::loadFromProjectFile(const ProjectFile *projectFile)
|
|||
}
|
||||
mUI.mEditTags->setText(projectFile->getTags().join(';'));
|
||||
updatePathsAndDefines();
|
||||
if(mUI.mEditImportProject->text().endsWith(".sln") || mUI.mEditImportProject->text().endsWith(".vcxproj")) {
|
||||
if (mUI.mEditImportProject->text().endsWith(".sln") || mUI.mEditImportProject->text().endsWith(".vcxproj")) {
|
||||
setVsConfigurations(getProjectConfigs(mUI.mEditImportProject->text()));
|
||||
foreach(const QString &cfg, projectFile->getVsConfigurations()) {
|
||||
foreach (const QString &cfg, projectFile->getVsConfigurations()) {
|
||||
QList<QListWidgetItem*> items = mUI.mListVsConfigs->findItems(cfg, Qt::MatchFlag::MatchExactly);
|
||||
items[0]->setSelected(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
mUI.mListVsConfigs->clear();
|
||||
mUI.mListVsConfigs->setEnabled(false);
|
||||
}
|
||||
|
@ -463,7 +462,7 @@ void ProjectFileDialog::updatePathsAndDefines()
|
|||
mUI.mBtnIncludeDown->setEnabled(!importProject);
|
||||
mUI.mChkAllVsConfigs->setEnabled(fileName.endsWith(".sln") || fileName.endsWith(".vcxproj"));
|
||||
mUI.mListVsConfigs->setEnabled(fileName.endsWith(".sln") || fileName.endsWith(".vcxproj"));
|
||||
if(!mUI.mListVsConfigs->isEnabled())
|
||||
if (!mUI.mListVsConfigs->isEnabled())
|
||||
mUI.mListVsConfigs->clear();
|
||||
}
|
||||
|
||||
|
@ -495,8 +494,8 @@ void ProjectFileDialog::browseImportProject()
|
|||
QStringList ProjectFileDialog::getVsConfigurations() const
|
||||
{
|
||||
QStringList configs;
|
||||
foreach(QListWidgetItem *item, mUI.mListVsConfigs->selectedItems())
|
||||
configs << item->text();
|
||||
foreach (QListWidgetItem *item, mUI.mListVsConfigs->selectedItems())
|
||||
configs << item->text();
|
||||
|
||||
return configs;
|
||||
}
|
||||
|
|
|
@ -1352,7 +1352,7 @@ void CppCheck::getErrorMessages()
|
|||
Preprocessor::getErrorMessages(this, &s);
|
||||
}
|
||||
|
||||
void CppCheck::analyseClangTidy(const ImportProject::FileSettings &fileSettings )
|
||||
void CppCheck::analyseClangTidy(const ImportProject::FileSettings &fileSettings)
|
||||
{
|
||||
std::string allIncludes = "";
|
||||
std::string allDefines = "-D"+fileSettings.defines;
|
||||
|
@ -1361,8 +1361,7 @@ void CppCheck::analyseClangTidy(const ImportProject::FileSettings &fileSettings
|
|||
}
|
||||
|
||||
std::string::size_type pos = 0u;
|
||||
while ((pos = allDefines.find(";", pos)) != std::string::npos)
|
||||
{
|
||||
while ((pos = allDefines.find(";", pos)) != std::string::npos) {
|
||||
allDefines.replace(pos, 1, " -D");
|
||||
pos += 3;
|
||||
}
|
||||
|
@ -1370,16 +1369,15 @@ void CppCheck::analyseClangTidy(const ImportProject::FileSettings &fileSettings
|
|||
const std::string cmd = "clang-tidy -quiet -checks=*,-clang-analyzer-*,-llvm* \"" + fileSettings.filename + "\" -- " + allIncludes + allDefines;
|
||||
std::pair<bool, std::string> result = executeCommand(cmd);
|
||||
if (!result.first) {
|
||||
std::cerr << "Failed to execute '" + cmd + "'" << std::endl;
|
||||
return;
|
||||
std::cerr << "Failed to execute '" + cmd + "'" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// parse output and create error messages
|
||||
std::istringstream istr(result.second);
|
||||
std::string line;
|
||||
|
||||
if (!mSettings.buildDir.empty())
|
||||
{
|
||||
if (!mSettings.buildDir.empty()) {
|
||||
const std::string analyzerInfoFile = AnalyzerInformation::getAnalyzerInfoFile(mSettings.buildDir, fileSettings.filename, "");
|
||||
std::ofstream fcmd(analyzerInfoFile + ".clang-tidy-cmd");
|
||||
fcmd << istr.str();
|
||||
|
@ -1398,9 +1396,9 @@ void CppCheck::analyseClangTidy(const ImportProject::FileSettings &fileSettings
|
|||
const std::size_t endNamePos = line.rfind(":", endLinePos - 1);
|
||||
const std::size_t endMsgTypePos = line.find(':', endColumnPos + 2);
|
||||
const std::size_t endErrorPos = line.rfind('[', std::string::npos);
|
||||
if(endLinePos==std::string::npos || endNamePos==std::string::npos || endMsgTypePos==std::string::npos || endErrorPos==std::string::npos)
|
||||
if (endLinePos==std::string::npos || endNamePos==std::string::npos || endMsgTypePos==std::string::npos || endErrorPos==std::string::npos)
|
||||
continue;
|
||||
|
||||
|
||||
const std::string lineNumString = line.substr(endNamePos + 1, endLinePos - endNamePos - 1);
|
||||
const std::string columnNumString = line.substr(endLinePos + 1, endColumnPos - endLinePos - 1);
|
||||
const std::string errorTypeString = line.substr(endColumnPos + 1, endMsgTypePos - endColumnPos - 1);
|
||||
|
|
|
@ -664,7 +664,7 @@ void ImportProject::importVcxproj(const std::string &filename, std::map<std::str
|
|||
doChecking = true;
|
||||
break;
|
||||
}
|
||||
if(!doChecking)
|
||||
if (!doChecking)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1125,4 +1125,4 @@ void ImportProject::selectOneVsConfig(Settings::PlatformType platform)
|
|||
std::list<std::string> ImportProject::getVSConfigs()
|
||||
{
|
||||
return std::list<std::string> (mAllVSConfigs.begin(), mAllVSConfigs.end());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue