From fb38e87bf4128574f93b3e360f74584e1f82f8d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 31 Jan 2020 14:13:52 +0100 Subject: [PATCH] astyle formatting [ci skip] --- cli/cppcheckexecutor.cpp | 4 ++-- gui/projectfiledialog.cpp | 19 +++++++++---------- lib/cppcheck.cpp | 16 +++++++--------- lib/importproject.cpp | 4 ++-- 4 files changed, 20 insertions(+), 23 deletions(-) diff --git a/cli/cppcheckexecutor.cpp b/cli/cppcheckexecutor.cpp index 17c35d869..5dc582bac 100644 --- a/cli/cppcheckexecutor.cpp +++ b/cli/cppcheckexecutor.cpp @@ -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); } } diff --git a/gui/projectfiledialog.cpp b/gui/projectfiledialog.cpp index 3357d117b..cbc05147a 100644 --- a/gui/projectfiledialog.cpp +++ b/gui/projectfiledialog.cpp @@ -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 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; } diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index b12ce70fb..ebbe83a9b 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -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 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); diff --git a/lib/importproject.cpp b/lib/importproject.cpp index ca50e8f71..134588749 100644 --- a/lib/importproject.cpp +++ b/lib/importproject.cpp @@ -664,7 +664,7 @@ void ImportProject::importVcxproj(const std::string &filename, std::map ImportProject::getVSConfigs() { return std::list (mAllVSConfigs.begin(), mAllVSConfigs.end()); -} \ No newline at end of file +} \ No newline at end of file