1
0

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
This commit is contained in:
peterbell10
2020-05-14 23:15:35 +01:00
committed by GitHub
parent edb548f9d6
commit 13144a08e4
100 changed files with 286 additions and 297 deletions

View File

@@ -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")