Skip to content

Repository Quality: Remediate 78 Non-Compliant TODO Comments (Policy Enforcement)Β #8835

@Evangelink

Description

@Evangelink

🎯 Repository Quality Improvement Report β€” TODO Policy Compliance

Analysis Date: 2026-06-04
Focus Area: TODO Comment Policy Compliance
Strategy Type: Custom

Executive Summary

The repository's CONTRIBUTING.md enforces a clear TODO comment policy: every TODO must reference a GitHub issue (e.g., // TODO(#1234): ...), and comments that don't warrant a tracking issue must be converted to plain explanatory comments. This analysis found 61 non-compliant TODO/FIXME comments in src/ and 17 more in test/, for a total of 78 policy violations across the codebase.

Only 2 source-level TODOs follow the required format (TODO(#NNN) or // TODO: ... tracked by #NNN). The violations are concentrated in the Platform component (30) and Adapter (20), but span every major area. Several comments reference work that has clear remediation paths and would benefit from proper issue tracking, while others are design questions or exploratory notes that should simply be reworded as plain comments.

The immediate risk is twofold: (1) legitimate technical debt is invisible to issue-tracking and may be forgotten, and (2) new contributors following existing patterns will perpetuate non-compliant TODOs. Addressing this in batches by component would improve both code hygiene and technical debt visibility.

Full Analysis Report

Focus Area: TODO Comment Policy Compliance

Current State Assessment

Metrics Collected:

Metric Value Status
Non-compliant TODOs in src/ 61 ❌
Non-compliant TODOs in test/ 17 ❌
Compliant TODOs (TODO(#NNN) format) in src/ 2 ⚠️
Platform component violations 30 ❌
Adapter component violations 20 ❌
Analyzers/SourceGeneration violations 8 ⚠️
TestFramework violations 3 ⚠️
Policy documented in CONTRIBUTING.md βœ… βœ…

Findings

Strengths

  • The TODO policy is clearly documented in CONTRIBUTING.md
  • The two compliant TODOs (TODO(#8772) and TODO(#8086) style) show that contributors know the correct format
  • Several violations reference GitHub issues inline (e.g., issue: https://github.com/microsoft/testfx/issues/2999), demonstrating partial awareness of the policy

Areas for Improvement

Platform (30 violations β€” High severity):

  • src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.cs:83 β€” VSTest compatibility gap (no issue)
  • src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Metadata.cs:12,46,62,63 β€” Multiple TRX compatibility TODOs
  • src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Results.cs:176,177,290 β€” TRX result format gaps
  • src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Results.Definitions.cs:96 β€” Missing Workitems support
  • src/Platform/Microsoft.Testing.Platform/OutputDevice/SimplifiedConsoleOutputDeviceBase.cs:213 β€” Logic duplication
  • src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/SimpleTerminalBase.cs:167 β€” Refactoring note
  • src/Platform/Microsoft.Testing.Platform/OutputDevice/OutputDeviceManager.cs:22 β€” Non-public API note
  • src/Platform/Microsoft.Testing.Platform/Hosts/ToolsTestHost.cs:53,54 β€” Two untracked design questions
  • src/Platform/Microsoft.Testing.Platform/ServerMode/JsonRpc/SerializerUtilities.cs:150 β€” Incomplete implementation note
  • src/Platform/Microsoft.Testing.Extensions.VSTestBridge/Helpers/RunSettingsHelpers.cs:13 β€” Dual code path issue
  • src/Platform/Microsoft.Testing.Extensions.VSTestBridge/ObjectModel/ObjectModelConverters.cs:153 β€” TRX generic class question
  • src/Platform/Microsoft.Testing.Extensions.VSTestBridge/ObjectModel/RunSettingsAdapter.cs:54 β€” Unimplemented stub note
  • src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/QuarantineFile.cs:16 β€” Feature design note
  • src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsRunIdCoordinator.cs:87 β€” Race condition concern

Adapter (20 violations β€” High severity):

  • src/Adapter/MSTestAdapter.PlatformServices/Execution/TestExecutionManager.cs:576 β€” AppDomain removal blocker
  • src/Adapter/MSTestAdapter.PlatformServices/Execution/TestMethodInfo.Execution.cs:104 β€” DRY violation note
  • src/Adapter/MSTestAdapter.PlatformServices/Execution/TestMethodInfo.Execution.cs:365,379 β€” Context propagation + blocking
  • src/Adapter/MSTestAdapter.PlatformServices/Execution/ExceptionHelper.cs:34 β€” Stack trace bug
  • src/Adapter/MSTestAdapter.PlatformServices/Discovery/TypeEnumerator.cs:151,198 β€” Perf + test fixup notes
  • src/Adapter/MSTestAdapter.PlatformServices/Discovery/AssemblyEnumerator.cs:250 β€” Architecture TODO
  • src/Adapter/MSTestAdapter.PlatformServices/Utilities/DeploymentItemUtility.cs:130 β€” Potential NRE
  • src/Adapter/MSTestAdapter.PlatformServices/Utilities/AppDomainUtilities.cs:60 β€” Missing test coverage
  • src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs:122,165 β€” Duplicate nullable concern
  • src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestBridgedTestFramework.cs:103 β€” API question
  • src/Adapter/MSTestAdapter.PlatformServices/Helpers/RuntimeContext.cs:9 β€” Architecture concern
  • src/Adapter/MSTest.Engine/Engine/TestExecutionContext.cs:65,69 β€” Two design TODOs

Analyzers / SourceGeneration (8 violations β€” Medium severity):

  • src/Analyzers/MSTest.Analyzers/RoslynAnalyzerHelpers/DiagnosticExtensions.cs:140 β€” Old reflection workaround
  • src/Analyzers/MSTest.Analyzers/AssertThrowsShouldContainSingleStatementAnalyzer.cs:103 β€” Design question
  • src/Analyzers/MSTest.Analyzers/AssertionArgsShouldAvoidConditionalAccessAnalyzer.cs:37,38 β€” Two design questions
  • src/Analyzers/MSTest.SourceGeneration/Generators/TestNodesGenerator.cs:65 β€” Namespace resolution
  • src/Analyzers/MSTest.SourceGeneration/ObjectModels/TestTypeInfo.cs:130 β€” Same namespace issue
  • src/Analyzers/MSTest.SourceGeneration/ObjectModels/TestMethodInfo.cs:136 β€” DataRow+DynamicData gap

TestFramework (3 violations β€” Low severity):

  • src/TestFramework/TestFramework.Extensions/Attributes/WinUI_UITestMethodAttribute.cs:46 β€” Nullable assumption
  • src/TestFramework/TestFramework.Extensions/Attributes/DeploymentItemAttribute.cs:26 β€” API availability note
  • src/TestFramework/TestFramework.Extensions/PrivateObject.Helpers.cs:84 β€” Nullable concern

πŸ€– Suggested Improvement Tasks

The following actionable tasks address the findings above.

Task 1: Remediate non-compliant TODOs in src/Platform/ (TrxReport)

Priority: High
Estimated Effort: Medium

The TrxReport component has the highest concentration of non-compliant TODOs (β‰₯8), many describing known gaps relative to VSTest's TRX output format. These represent real behavioral differences that users may observe.

For each TODO in src/Platform/Microsoft.Testing.Extensions.TrxReport/:

  1. Open a GitHub issue describing the gap (e.g., "TrxReport: missing runUser attribute", "TrxReport: ResultFiles support")
  2. Replace the bare // TODO: ... with // TODO(#NNNN): ... referencing the new issue, or β€” if the gap is intentional/out-of-scope β€” reword it as a plain comment explaining why

Files to address:

  • TrxReportEngine.cs:83
  • TrxReportEngine.Metadata.cs:12,46,62,63
  • TrxReportEngine.Results.cs:176,177,290
  • TrxReportEngine.Results.Definitions.cs:96
  • TrxDataConsumer.cs:175

Task 2: Remediate non-compliant TODOs in src/Platform/ (MTP core + extensions)

Priority: High
Estimated Effort: Medium

The remaining Platform TODOs span Microsoft.Testing.Platform, VSTestBridge, and AzureDevOpsReport. Several describe architecture concerns or missing features that should be tracked.

Files to address:

  • src/Platform/Microsoft.Testing.Platform/OutputDevice/SimplifiedConsoleOutputDeviceBase.cs:213
  • src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/SimpleTerminalBase.cs:167
  • src/Platform/Microsoft.Testing.Platform/OutputDevice/OutputDeviceManager.cs:22
  • src/Platform/Microsoft.Testing.Platform/Hosts/ToolsTestHost.cs:53,54
  • src/Platform/Microsoft.Testing.Platform/ServerMode/JsonRpc/SerializerUtilities.cs:150
  • src/Platform/Microsoft.Testing.Extensions.VSTestBridge/Helpers/RunSettingsHelpers.cs:13
  • src/Platform/Microsoft.Testing.Extensions.VSTestBridge/ObjectModel/ObjectModelConverters.cs:153
  • src/Platform/Microsoft.Testing.Extensions.VSTestBridge/ObjectModel/RunSettingsAdapter.cs:54
  • src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/QuarantineFile.cs:16
  • src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsRunIdCoordinator.cs:87

For design-question TODOs (e.g., "Should TRX className have arity?"), either file an issue for the decision or convert to a plain comment.


Task 3: Remediate non-compliant TODOs in src/Adapter/

Priority: High
Estimated Effort: Medium

The Adapter has 20 violations spanning discovery, execution, and utilities. Notable ones include a potential NRE (DeploymentItemUtility.cs:130), a DRY violation note (TestMethodInfo.Execution.cs:104), a stack trace bug (ExceptionHelper.cs:34), and a blocking-call concern (TestMethodInfo.Execution.cs:379).

For concrete bugs/improvements: open a tracking issue and update the comment format.
For design questions without a clear path: convert to plain // comments explaining the context.

Files to address: all 20 occurrences in src/Adapter/ listed in the analysis above.


Task 4: Remediate non-compliant TODOs in src/Analyzers/ and src/TestFramework/

Priority: Medium
Estimated Effort: Small

The Analyzers and TestFramework components have 11 combined violations. The SourceGeneration namespace has a recurring issue around assembly default namespace resolution (3 TODOs referencing the same problem) β€” these should share a single tracking issue.

Key items:

  • DiagnosticExtensions.cs:140 β€” "Revert reflection workaround once CodeAnalysis 3.0" is shipped: verify if CodeAnalysis 3.0+ is already in use, and either remove the workaround or open/link an issue
  • AssertionArgsShouldAvoidConditionalAccessAnalyzer.cs:37,38 β€” Convert open design questions to plain comments or open a discussion issue
  • TestNodesGenerator.cs:65 + TestTypeInfo.cs:130 β€” Share one issue for the namespace resolution gap

Task 5: Add automated enforcement to prevent future policy regressions

Priority: Medium
Estimated Effort: Small

Once all existing violations are cleared, add a CI gate to prevent new non-compliant TODOs from being merged. Options:

  1. Roslyn analyzer rule: Add or configure an existing analyzer to warn on bare // TODO comments lacking (#NNN). The repo already ships MSTest.Analyzers and has the tooling in place.
  2. EditorConfig + build warning: Enable SA1113 (StyleCop) or configure a custom Roslyn suppressor/diagnostic.
  3. Simple grep-based CI step: Add a step to the PR validation workflow that runs grep -rn "TODO\|FIXME" src/ test/ --include="*.cs" | grep -v "#[0-9]\+" | grep -v "obj\|bin" and fails if the output is non-empty.

The grep-based approach is the fastest to implement and would catch regressions immediately.


πŸ“Š Historical Context

Previous Focus Areas
Date Focus Area Type
2026-06-04 TODO Policy Compliance Custom

🎯 Recommendations

Immediate Actions (This Week)

  1. Triage and batch the 61 source TODOs β€” assign owners by component (Platform, Adapter, Analyzers) β€” Priority: High
  2. Convert untracked design-question TODOs to plain comments for ones that clearly don't warrant issues β€” Priority: High

Short-term Actions (This Month)

  1. Open tracking issues for substantive tech debt (NRE risks, DRY violations, architecture concerns) referenced in Tasks 1–4 β€” Priority: High
  2. Add CI enforcement (Task 5) to prevent regression once existing violations are resolved β€” Priority: Medium
  3. Apply the same cleanup pass to test/ (17 more violations) β€” Priority: Low

Generated by Repository Quality Improvement Agent
Next analysis: 2026-06-05 β€” Focus area selected based on diversity algorithm

Generated by Repository Quality Improver Β· sonnet46 2.4M Β· β—·

Add this agentic workflows to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repository-quality-improver.md@main
  • expires on Jun 6, 2026, 10:53 PM UTC

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/automationCreated or maintained by an agentic workflow.type/tech-debtCode health, refactoring, simplification.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions