From 13144a08e496b89b34093ffd3d810d3442df3c44 Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Thu, 14 May 2020 23:15:35 +0100 Subject: Enable some more clang-tidy linter checks (#4738) * Avoid inefficient AString -> c_str() -> AString round trip * Avoid redundant string init expressions * Avoid unnecessary return, continue, etc. * Add .clang-format to help with clang-tidy fix-its * Avoid unnecessary passing by value * Avoid unnecessary local copying * Avoid copying in range-for loops * Avoid over-complicated boolean expressions * Some violations missed by my local clang-tidy * Allow unnecessary continue statements * Add brackets * Another expression missed locally * Move BindingsProcessor call into clang-tidy.sh and add space * Fix pushd not found error * Different grouping of CheckBlockInteractionRate --- src/Bindings/PluginManager.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Bindings/PluginManager.cpp') diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index b57f3779f..88bc82172 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -57,7 +57,7 @@ void cPluginManager::RefreshPluginList(void) { // Get a list of currently available folders: AString PluginsPath = GetPluginsPath() + "/"; - AStringVector Contents = cFile::GetFolderContents(PluginsPath.c_str()); + AStringVector Contents = cFile::GetFolderContents(PluginsPath); AStringVector Folders; for (auto & item: Contents) { @@ -1401,7 +1401,7 @@ bool cPluginManager::BindCommand( auto & reg = m_Commands[a_Command]; reg.m_Plugin = a_Plugin; - reg.m_Handler = a_Handler; + reg.m_Handler = std::move(a_Handler); reg.m_Permission = a_Permission; reg.m_HelpString = a_HelpString; return true; @@ -1508,7 +1508,7 @@ bool cPluginManager::BindConsoleCommand( auto & reg = m_ConsoleCommands[a_Command]; reg.m_Plugin = a_Plugin; - reg.m_Handler = a_Handler; + reg.m_Handler = std::move(a_Handler); reg.m_Permission = ""; reg.m_HelpString = a_HelpString; return true; @@ -1739,7 +1739,7 @@ AStringVector cPluginManager::GetFoldersToLoad(cSettingsRepositoryInterface & a_ // Get the old format plugin list, and migrate it. // Upgrade path added on 2020-03-27 auto OldValues = a_Settings.GetValues("Plugins"); - for (auto NameValue : OldValues) + for (const auto & NameValue : OldValues) { AString ValueName = NameValue.first; if (ValueName.compare("Plugin") == 0) @@ -1759,7 +1759,7 @@ AStringVector cPluginManager::GetFoldersToLoad(cSettingsRepositoryInterface & a_ // Get the list of plugins to load: auto Values = a_Settings.GetValues("Plugins"); - for (auto NameValue : Values) + for (const auto & NameValue : Values) { AString Enabled = NameValue.second; if (Enabled == "1") -- cgit v1.2.3