Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[file-diet] Refactor AzureDevOpsSummaryReporter.Markdown.cs (552 lines) into focused partials

Open
#11,982 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
csharp
Domain
testing

Research direction

Start with src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsSummaryReporter.Markdown.cs and the sibling partials AzureDevOpsSummaryReporter.cs and AzureDevOpsSummaryReporter.Lifecycle.cs, reading the method bodies before moving any code. Check the behavior-preserving-refactor skill for the equivalence checks, then split the proposed Aggregate, History and Formatting partials. Done means each new file is under 300 lines, the affected project builds, and the existing reporter tests pass.

Written by the indexing model from the issue text.

Description

type/automation type/tech-debt
Overview

The file src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsSummaryReporter.Markdown.cs has grown to 552 lines, making it harder to navigate and maintain. This task involves refactoring it into smaller, more focused files.

Current State
  • File: src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsSummaryReporter.Markdown.cs
  • Size: 552 lines
  • Language: C#
Structural Analysis

This file is one partial of internal sealed partial class AzureDevOpsSummaryReporter (the other partials live alongside it as AzureDevOpsSummaryReporter.cs and AzureDevOpsSummaryReporter.Lifecycle.cs). Based on the bounded sample (first 100 lines + method signature grep), it contains:

  • Per-module markdown building (BuildMarkdown overloads, lines ~17-68): builds the Markdown summary for a single module/test run, including status strip and coverage/diagnostics sections.
  • Aggregate markdown building (BuildAggregateMarkdown, AppendModuleDiagnostics, HasFailureDetails, lines ~70-293): builds the overall multi-module summary, including failure detail aggregation.
  • History/trend formatting (AppendHistoryMarkdown, FormatHistoricalDuration, GetHistoricalFailureRate, GetDurationRatio, lines ~294-364 and ~439-454): renders historical test duration/failure-rate trend data.
  • Dependency listing (AppendDependenciesMarkdown, lines ~365-404): renders the module dependency list.
  • Status strip / duration formatting (FormatDuration, AppendStatusStrip, lines ~405-438): shared small formatting helpers for pass/fail/skip counts and durations.
  • Low-level text/markdown utility helpers (GetQualifiedTestLabel, AppendBlockQuote, FormatTestName, AppendModuleIdentity, EscapeCell, HtmlEncode, HasDuplicateModuleIdentity, lines ~455-552): string escaping, label qualification, and identity formatting used across the other sections.
Refactoring Strategy
Proposed File Splits

Based on the bounded structural sample, investigate these proposed splits. Confirm their safety during implementation preflight before moving code (all remain partial members of AzureDevOpsSummaryReporter, consistent with the existing .Lifecycle.cs partial naming convention):

  1. AzureDevOpsSummaryReporter.Markdown.Aggregate.cs

    • Contents: BuildAggregateMarkdown, AppendModuleDiagnostics, HasFailureDetails
    • Responsibility: Building the overall/aggregate multi-module Markdown summary and failure-detail aggregation.
  2. AzureDevOpsSummaryReporter.Markdown.History.cs

    • Contents: AppendHistoryMarkdown, AppendDependenciesMarkdown, FormatHistoricalDuration, GetHistoricalFailureRate, GetDurationRatio
    • Responsibility: Rendering historical trend data (duration/failure-rate) and dependency lists.
  3. AzureDevOpsSummaryReporter.Markdown.Formatting.cs (if needed)

    • Contents: FormatDuration, AppendStatusStrip, GetQualifiedTestLabel, AppendBlockQuote, FormatTestName, AppendModuleIdentity, EscapeCell, HtmlEncode, HasDuplicateModuleIdentity
    • Responsibility: Shared low-level string/Markdown formatting and escaping utilities used by the other partials.

The original AzureDevOpsSummaryReporter.Markdown.cs would retain the per-module BuildMarkdown overloads as the primary entry point.

Implementation Guidelines
  1. Establish Equivalence: Follow .github/skills/behavior-preserving-refactor/SKILL.md. Before editing, read the complete affected bodies, inventory baseline behavior and relevant tests, and identify distinguishing cases.
  2. Preserve Selection and Evaluation: Keep iteration order, short-circuit evaluation, exact type selection, first/last-match semantics, defaults, exceptions, and side effects. Cover reachable duplicate and malformed inputs; similar-looking helpers are not automatically interchangeable.
  3. Trace All Consumers: Check partial declarations, source-linked consumers, owning/consuming project includes, target-framework guards, and tracked public/internal API surfaces. Keep names, accessibility, attributes, and native interop contracts unchanged.
  4. Move Before Modernizing: Move bodies unchanged first, one coherent responsibility at a time. Preserve allocation and performance behavior on hot paths; do not mix adjacent modernization or bug fixes into the split.
  5. Use Focused Checks: Run the smallest affected project/TFM builds and relevant tests before and after each coherent split. Add distinguishing equivalence cases where coverage is missing; a pure file move does not require the full solution. Report exact checks and outcomes, including unavailable checks.
  6. Surface Constraints: Measure resulting line counts. If a safe structural split cannot meet the size goal without changing semantics, report the remaining size and blocker rather than forcing behavior changes.
Acceptance Criteria
  • Original file is split into focused modules
  • Each new file is under 300 lines, or a concrete behavior-preservation blocker and remaining size are reported
  • Baseline semantics, including reachable duplicate/malformed cases and evaluation order, are preserved by focused equivalence checks
  • Relevant builds and tests pass for affected consumers/TFMs; exact checks and any validation gaps are reported
  • Public and tracked internal API contracts, attributes, and conditional compilation are preserved
  • Project includes, source links, and package layout still include the moved code for every affected consumer

Priority: Medium
Effort: Small
Expected Impact: Improved code navigability, easier testing, reduced merge conflicts

🤖 Automated content by GitHub Copilot. Generated by the Daily File Diet workflow. · copilot · auto · 43.9 AIC · ⌖ 5.2 AIC · ⊞ 13.1K · [◷]( · ◷)

  • expires on Oct 18, 2026, 6:58 PM UTC
Dominant language
C#
Stars
1k
Forks
314
Avg merge
9h 33m
Merged PRs (30d)
427

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/testfx

All issues in microsoft/testfx

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.