Skip to content

Commit 66e6661

Browse files
authored
Make non-compliant TODO comments policy-compliant (#9878)
1 parent 8503466 commit 66e6661

28 files changed

Lines changed: 44 additions & 42 deletions

File tree

‎src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ internal async Task RunTestsAsync(IEnumerable<TestCase>? tests, IRunContext? run
124124
throw new ArgumentNullException(nameof(frameworkHandle));
125125
}
126126

127-
// TODO: Verify why VSTest annotates the IEnumerable as nullable.
127+
// VSTest annotates the IEnumerable as nullable; the exact reason is unclear.
128128
if (tests is null)
129129
{
130130
throw new ArgumentNullException(nameof(tests));
@@ -203,7 +203,7 @@ private async Task RunTestsFromSourcesCoreAsync(IEnumerable<string>? sources, IR
203203
throw new ArgumentNullException(nameof(frameworkHandle));
204204
}
205205

206-
// TODO: Verify why VSTest annotates the IEnumerable as nullable.
206+
// VSTest annotates the IEnumerable as nullable; the exact reason is unclear.
207207
if (sources is null)
208208
{
209209
throw new ArgumentNullException(nameof(sources));

‎src/Adapter/MSTestAdapter.PlatformServices/Data/TestDataConnectionSql.Schema.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public override List<string> GetDataTablesAndViews()
4545

4646
SchemaMetaData[] metadatas = GetSchemaMetaData();
4747

48-
// TODO: may be find better way to enumerate tables/views.
48+
// There may be a better way to enumerate tables/views.
4949
foreach (SchemaMetaData metadata in metadatas)
5050
{
5151
DataTable? dataTable = null;

‎src/Adapter/MSTestAdapter.PlatformServices/Discovery/AssemblyEnumerator.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ private static bool TryUnfoldITestDataSources(UnitTestElement test, DiscoveryTes
247247
isDataDriven = true;
248248
if (!TryUnfoldITestDataSource(dataSource, test, new(testMethodInfo.MethodInfo, test.TestMethod.DisplayName), tempListOfTests, ref globalTestCaseIndex, mustSerialize))
249249
{
250-
// TODO: Improve multi-source design!
250+
// The multi-source design could be improved.
251251
// Ideally we would want to consider each data source separately but when one source cannot be expanded,
252252
// we will run all sources from the given method so we need to bail-out "globally".
253253
return false;

‎src/Adapter/MSTestAdapter.PlatformServices/Discovery/TypeEnumerator.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ internal UnitTestElement GetTestFromMethod(MethodInfo method, bool classDisables
148148
MethodInfo = method,
149149
};
150150

151-
// TODO: For every test method in a class, we are asking reflect helper multiple times for the same
151+
// For every test method in a class, we are asking reflect helper multiple times for the same
152152
// information (like test categories, traits, deployment items) which is not optimal.
153153
IReflectionOperations reflectionOperations = PlatformServiceProvider.Instance.ReflectionOperations;
154154
var testElement = new UnitTestElement(testMethod)
@@ -195,7 +195,7 @@ internal UnitTestElement GetTestFromMethod(MethodInfo method, bool classDisables
195195

196196
// In production, we always have a TestMethod attribute because GetTestFromMethod is called under IsValidTestMethod
197197
// In unit tests, we may not have the test to have TestMethodAttribute.
198-
// TODO: Adjust all unit tests to properly have the attribute and uncomment the assert.
198+
// Unit tests could be adjusted to properly have the attribute so the assert can be uncommented.
199199
// DebugEx.Assert(testMethodAttribute is not null, "Expected to find a 'TestMethod' attribute.");
200200

201201
// get DisplayName from TestMethodAttribute (or any inherited attribute)

‎src/Adapter/MSTestAdapter.PlatformServices/Execution/ExceptionHelper.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ internal static class ExceptionHelper
3131
curException != null;
3232
curException = curException.InnerException)
3333
{
34-
// TODO:Fix the shadow stack-trace used in Private Object
34+
// The shadow stack-trace used in Private Object could be improved.
3535
// (Look-in Assertion.cs in the UnitTestFramework assembly)
3636

3737
// Sometimes the stack trace can be null, but the inner stack trace

‎src/Adapter/MSTestAdapter.PlatformServices/Execution/TestMethodInfo.Execution.cs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private async Task<TestResult> ExecuteInternalAsync(object?[]? arguments, Cancel
102102
}
103103
}
104104

105-
// TODO remove dry violation with TestMethodRunner
105+
// This duplicates logic in TestMethodRunner (DRY violation).
106106
bool setTestContextSucessful = false;
107107
if (_executionContext is null)
108108
{
@@ -348,7 +348,7 @@ async SynchronizationContextPreservingTask<TestResult> ExecuteWithTimeoutTokenAs
348348

349349
TestResult timeoutResult = new() { Outcome = UnitTestOutcome.Timeout, TestFailureException = new TestFailedException(UnitTestOutcome.Timeout, errorMessage) };
350350

351-
// TODO: execution context propagation here may still not be accurate.
351+
// Execution context propagation here may still not be accurate.
352352
// if test init was successfully executed by ExecuteAsyncAction, but then the test itself timed out or cancelled,
353353
// then at this point we will run the cleanup on an execution context that doesn't have any state set by the test initialize.
354354

@@ -362,7 +362,7 @@ void ExecuteAsyncAction()
362362
{
363363
try
364364
{
365-
// TODO: Avoid blocking.
365+
// Ideally this would avoid blocking.
366366
// This used to always happen, but now is moved to the code path where there is a Timeout on the test method.
367367
// The GetAwaiter().GetResult() call here can be a source of deadlocks, especially for UWP/WinUI.
368368
// When the test method has `await`s with ConfigureAwait(true) (which is the default), the continuation is

‎src/Adapter/MSTestAdapter.PlatformServices/Extensions/MethodInfoExtensions.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ private static MethodInfo ConstructGenericMethod(MethodInfo methodInfo, Paramete
380380

381381
for (int i = 0; i < map.Length; i++)
382382
{
383-
// TODO: Better to throw? or tolerate and transform to typeof(object)?
383+
// It is unclear whether it is better to throw here or tolerate and transform to typeof(object).
384384
// This is reachable in the following case for example:
385385
// [DataRow(null)]
386386
// public void TestMethod<T>(T t) { }

‎src/Adapter/MSTestAdapter.PlatformServices/Helpers/RuntimeContext.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Helpers;
66
internal static class RuntimeContext
77
{
88
private static readonly Lazy<bool> IsHotReloadEnabledLazy = new(() =>
9-
// TODO: We should be using a capability from the runner instead of looking at environment variables.
9+
// Ideally we would use a capability from the runner instead of looking at environment variables.
1010
Environment.GetEnvironmentVariable("DOTNET_WATCH") == "1"
1111
|| Environment.GetEnvironmentVariable("TESTINGPLATFORM_HOTRELOAD_ENABLED") == "1");
1212

‎src/Adapter/MSTestAdapter.PlatformServices/Utilities/AppDomainUtilities.cs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ internal static void SetAppDomainFrameworkVersionBasedOnTestSource(AppDomainSetu
6868
/// The path of the dll.
6969
/// </param>
7070
/// <returns>
71-
/// Framework string
72-
/// TODO: Need to add components/E2E tests to cover these scenarios.
71+
/// Framework string.
7372
/// </returns>
73+
/// <remarks>
74+
/// Components/E2E tests could be added to cover these scenarios.
75+
/// </remarks>
7476
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "Reviewed. Suppression is OK here.")]
7577
internal static string GetTargetFrameworkVersionString(string testSourcePath)
7678
{

‎src/Adapter/MSTestAdapter.PlatformServices/Utilities/DeploymentItemUtility.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ internal static IList<DeploymentItem> GetDeploymentItems(IEnumerable<UnitTestEle
123123

124124
IList<DeploymentItem>? deploymentItemsToBeAdded = FromKeyValuePairs(items);
125125

126-
// TODO: Check if we can avoid potential NRE here.
126+
// deploymentItemsToBeAdded is never null here: items is non-empty (filtered above) and FromKeyValuePairs only returns null for an empty array.
127127
foreach (DeploymentItem deploymentItemToBeAdded in deploymentItemsToBeAdded!)
128128
{
129129
AddDeploymentItem(allDeploymentItems, deploymentItemToBeAdded);

0 commit comments

Comments
 (0)