Skip to content

Commit

Permalink
Do not bail after the first warning.
Browse files Browse the repository at this point in the history
Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
  • Loading branch information
joeykleingers committed Jan 15, 2024
1 parent 7a42d26 commit 4e4e1e3
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ inline std::string GeneratePythonFilter(const std::string& filterName, const std
*/
inline Result<> InsertFilterNameInPluginFiles(const std::filesystem::path& pluginPath, const std::string& filterName)
{
Result<> result;
std::string pluginName = pluginPath.stem().string();

fs::path pluginPyPath = pluginPath / "Plugin.py";
Expand Down Expand Up @@ -155,10 +156,10 @@ inline Result<> InsertFilterNameInPluginFiles(const std::filesystem::path& plugi
std::size_t filterInsertPos = content.find(k_FilterIncludeInsertToken);
if(filterInsertPos == std::string::npos)
{
return MakeWarningVoidResult(
-2002, fmt::format("Plugin file ('{0}') does not contain the filter insert token ('{1}'), so the filter import statement could not be automatically inserted into the plugin "
"file. This plugin file must be manually updated to include the filter import statement.",
pluginFilePath.string(), k_FilterNameInsertToken));
result.warnings().push_back(
{-2002, fmt::format("Plugin file ('{0}') does not contain the filter insert token ('{1}'), so the filter import statement could not be automatically inserted into the plugin "
"file. This plugin file must be manually updated to include the filter import statement.",
pluginFilePath.string(), k_FilterNameInsertToken)});
}
filterInsertPos--; // Go back one character to insert before the newline

Expand All @@ -171,10 +172,10 @@ inline Result<> InsertFilterNameInPluginFiles(const std::filesystem::path& plugi
std::size_t filterInsertPos = content.find(k_FilterNameInsertToken);
if(filterInsertPos == std::string::npos)
{
return MakeWarningVoidResult(-2002,
fmt::format("Plugin file ('{0}') does not contain the filter insert token ('{1}'), so the filter name ('{2}') could not be automatically inserted into the plugin "
"file. This plugin file must be manually updated to include the filter name ('{2}').",
pluginFilePath.string(), k_FilterNameInsertToken, filterName));
result.warnings().push_back(
{-2002, fmt::format("Plugin file ('{0}') does not contain the filter insert token ('{1}'), so the filter name ('{2}') could not be automatically inserted into the plugin "
"file. This plugin file must be manually updated to include the filter name ('{2}').",
pluginFilePath.string(), k_FilterNameInsertToken, filterName)});
}
filterInsertPos -= 2; // Go back two characters to insert before the closing brace

Expand All @@ -191,7 +192,7 @@ inline Result<> InsertFilterNameInPluginFiles(const std::filesystem::path& plugi
out_file.close();
}

return {};
return result;
}

/**
Expand Down

0 comments on commit 4e4e1e3

Please sign in to comment.