astyle formatting

[ci skip]
This commit is contained in:
Daniel Marjamäki 2020-01-31 14:13:52 +01:00
parent b0ce3e4c0c
commit fb38e87bf4
4 changed files with 20 additions and 23 deletions

View File

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

View File

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

View File

@ -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,7 +1396,7 @@ 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);

View File

@ -664,7 +664,7 @@ void ImportProject::importVcxproj(const std::string &filename, std::map<std::str
doChecking = true;
break;
}
if(!doChecking)
if (!doChecking)
continue;
}