Address PR comments

This commit is contained in:
jonawals
2021-05-28 12:33:27 +01:00
parent 684ef8046f
commit 728d3b4b98
4 changed files with 23 additions and 21 deletions
@@ -184,8 +184,8 @@ namespace TestImpact
Policy::TargetOutputCapture ParseTargetOutputCapture(const AZ::CommandLine& cmd)
{
const auto numSwitchValues = cmd.GetNumSwitchValues(OptionKeys[TargetOutputCapture]);
if (numSwitchValues)
if (const auto numSwitchValues = cmd.GetNumSwitchValues(OptionKeys[TargetOutputCapture]);
numSwitchValues)
{
AZ_TestImpact_Eval(
numSwitchValues <= 2, CommandLineOptionsException, "Unexpected parameters for target output capture option");
@@ -253,8 +253,8 @@ namespace TestImpact
AZStd::unordered_set<AZStd::string> ParseSuitesFilter(const AZ::CommandLine& cmd)
{
AZStd::unordered_set<AZStd::string> suitesFilter;
const auto numSwitchValues = cmd.GetNumSwitchValues(OptionKeys[SuitesFilter]);
if (numSwitchValues)
if (const auto numSwitchValues = cmd.GetNumSwitchValues(OptionKeys[SuitesFilter]);
numSwitchValues)
{
for (auto i = 0; i < numSwitchValues; i++)
{
@@ -460,4 +460,4 @@ namespace TestImpact
return help;
}
}
} // namespace TestImpact
@@ -25,7 +25,7 @@ namespace TestImpact
//! The type of test sequence to run.
enum class TestSequenceType
{
None, //!< Runs no tests and will report a all tests successful.
None, //!< Runs no tests and will report all tests successful.
Seed, //!< Removes any prior coverage data and runs all test targets with instrumentation to reseed the data from scratch.
Regular, //!< Runs all of the test targets without any instrumentation to generate coverage data (any prior coverage data is left intact).
ImpactAnalysis, //!< Uses any prior coverage data to run the instrumented subset of selected tests (if no prior coverage data a regular run is performed instead).
@@ -108,4 +108,4 @@ namespace TestImpact
AZStd::unordered_set<AZStd::string> m_suitesFilter;
bool m_safeMode = false;
};
}
} // namespace TestImpact
@@ -12,13 +12,15 @@
#include <TestImpactCommandLineOptionsUtils.h>
#include <AzCore/std/string/conversions.h>
namespace TestImpact
{
//! Attempts to parse a path option value.
AZStd::optional<RepoPath> ParsePathOption(const AZStd::string& optionName, const AZ::CommandLine& cmd)
{
const auto numSwitchValues = cmd.GetNumSwitchValues(optionName);
if (numSwitchValues)
{
if (const auto numSwitchValues = cmd.GetNumSwitchValues(optionName);
numSwitchValues)
{
AZ_TestImpact_Eval(
numSwitchValues == 1,
@@ -40,8 +42,8 @@ namespace TestImpact
//! Attempts to pass an unsigned integer option value.
AZStd::optional<size_t> ParseUnsignedIntegerOption(const AZStd::string& optionName, const AZ::CommandLine& cmd)
{
const auto numSwitchValues = cmd.GetNumSwitchValues(optionName);
if (numSwitchValues)
if (const auto numSwitchValues = cmd.GetNumSwitchValues(optionName);
numSwitchValues)
{
AZ_TestImpact_Eval(
numSwitchValues == 1,
@@ -49,11 +51,11 @@ namespace TestImpact
AZStd::string::format("Unexpected number of parameters for %s option", optionName.c_str()));
const auto str = cmd.GetSwitchValue(optionName, 0);
char* end = nullptr;
auto value = strtoul(str.c_str(), &end, 0);
size_t end = 0;
auto value = AZStd::stoul(str, &end, 0);
AZ_TestImpact_Eval(
end != str,
end,
CommandLineOptionsException,
AZStd::string::format("Couldn't parse unsigned integer option value: %s", str.c_str()));
@@ -74,4 +76,4 @@ namespace TestImpact
return AZStd::nullopt;
}
}
} // namespace TestImpact
@@ -38,8 +38,8 @@ namespace TestImpact
const AZStd::pair<OptionValue<T>,
OptionValue<T>>& state, const AZ::CommandLine& cmd)
{
const auto numSwitchValues = cmd.GetNumSwitchValues(optionName);
if (numSwitchValues)
if (const auto numSwitchValues = cmd.GetNumSwitchValues(optionName);
numSwitchValues)
{
AZ_TestImpact_Eval(
numSwitchValues == 1,
@@ -70,8 +70,8 @@ namespace TestImpact
const AZStd::vector<AZStd::pair<AZStd::string, T>>& states,
const AZ::CommandLine& cmd)
{
const auto numSwitchValues = cmd.GetNumSwitchValues(optionName);
if (numSwitchValues)
if (const auto numSwitchValues = cmd.GetNumSwitchValues(optionName);
numSwitchValues)
{
AZ_TestImpact_Eval(
numSwitchValues == 1,
@@ -116,4 +116,4 @@ namespace TestImpact
//! Attempts to parse an option value in seconds.
AZStd::optional<AZStd::chrono::milliseconds> ParseSecondsOption(const AZStd::string& optionName, const AZ::CommandLine& cmd);
}
} // namespace TestImpact