From 03880a32adcfdcaeebcf522e33d98b9fca473ba8 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Thu, 11 Nov 2021 20:00:02 +0100 Subject: [PATCH] prefer empty --- .clang-tidy | 5 ++++- Base/Util/PyFmt.cpp | 2 +- GUI/Model/Group/GroupInfo.cpp | 2 +- GUI/Model/Job/JobItemUtils.cpp | 2 +- Tests/Functional/Core/Consistence/CompareTwoReferences.cpp | 2 +- Tests/Functional/Core/Std/Check.cpp | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 3932fd58cde..e28390b5b37 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -67,6 +67,7 @@ Checks: '*, -cppcoreguidelines-avoid-non-const-global-variables, -llvm-include-order, -readability-redundant-access-specifiers, +-*special-member-functions, -SectionComment_Resolving_the_following_checks_would_be_too_much_work_right_now, @@ -81,11 +82,13 @@ Checks: '*, -bugprone-parent-virtual-call, -clang-analyzer-core.CallAndMessage, -clang-analyzer-optin.cplusplus.VirtualCall, +-hicpp-member-init, -modernize-loop-convert, -modernize-pass-by-value, -modernize-use-using, --special-member-functions, +-misc-non-private-member-variables-in-classes, -SectionComment_Temporarily_disabled_checks__We_need_to_investigate_them_one_by_one, + ' diff --git a/Base/Util/PyFmt.cpp b/Base/Util/PyFmt.cpp index 967cc670c0e..2fc6defad0a 100644 --- a/Base/Util/PyFmt.cpp +++ b/Base/Util/PyFmt.cpp @@ -126,7 +126,7 @@ std::string printValue(double value, const std::string& units) return printDegrees(value); if (units == "nm") return printNm(value); - if (units == "") + if (units.empty()) return printDouble(value); ASSERT(0); } diff --git a/GUI/Model/Group/GroupInfo.cpp b/GUI/Model/Group/GroupInfo.cpp index 3076902f7a3..c85e69efdd8 100644 --- a/GUI/Model/Group/GroupInfo.cpp +++ b/GUI/Model/Group/GroupInfo.cpp @@ -48,7 +48,7 @@ void GroupInfo::add(const QString& itemType) QString GroupInfo::defaultType() const { - if (m_defaultItemType == "" && m_info.size() != 0) + if (m_defaultItemType.empty() && !m_info.empty()) return m_info[0].m_itemType; return m_defaultItemType; } diff --git a/GUI/Model/Job/JobItemUtils.cpp b/GUI/Model/Job/JobItemUtils.cpp index 16ef5bd19dc..2c109e41327 100644 --- a/GUI/Model/Job/JobItemUtils.cpp +++ b/GUI/Model/Job/JobItemUtils.cpp @@ -134,7 +134,7 @@ ComboProperty GUI::Model::JobItemUtils::availableUnits(const ICoordSystem& conve ComboProperty result; for (auto units : converter.availableUnits()) { auto unit_name = nameFromCoords(units); - if (unit_name != "") + if (!unit_name.empty()) result << unit_name; } diff --git a/Tests/Functional/Core/Consistence/CompareTwoReferences.cpp b/Tests/Functional/Core/Consistence/CompareTwoReferences.cpp index 5e7ef5028d3..dabbe078071 100644 --- a/Tests/Functional/Core/Consistence/CompareTwoReferences.cpp +++ b/Tests/Functional/Core/Consistence/CompareTwoReferences.cpp @@ -22,7 +22,7 @@ namespace { std::unique_ptr<OutputData<double>> load(const std::string& name) { - ASSERT(name != ""); + ASSERT(!name.empty()); const std::string path = BaseUtils::Filesystem::jointPath(BATesting::ReferenceDir_Std(), name + ".int.gz"); std::unique_ptr<OutputData<double>> data; diff --git a/Tests/Functional/Core/Std/Check.cpp b/Tests/Functional/Core/Std/Check.cpp index 8b9fac9494c..59e83a18a03 100644 --- a/Tests/Functional/Core/Std/Check.cpp +++ b/Tests/Functional/Core/Std/Check.cpp @@ -32,7 +32,7 @@ bool checkSimulation(const std::string& name, const ISimulation& direct_simulati std::unique_ptr<OutputData<double>> reference; // Load reference if available. - ASSERT(name != ""); + ASSERT(!name.empty()); try { const std::string refPath = BaseUtils::Filesystem::jointPath(BATesting::ReferenceDir_Std(), name + ".int.gz"); -- GitLab