[file-diet] Refactor RedundantTestMethodAttributeAnalyzer.cs (624 lines) into focused files
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- csharp
- Ambito
- developer-experience
Direzione di ricerca
Read .github/skills/behavior-preserving-refactor/SKILL.md and the complete analyzer at src/Analyzers/MSTest.Analyzers/RedundantTestMethodAttributeAnalyzer.cs; inspect the relevant MSTest.Analyzers.UnitTests and project includes or source links before moving code. Preserve method bodies and evaluation behavior as you split the analyzer into focused files. Done means each file is under 300 lines, or a specific behavior-preservation blocker and remaining size are reported, with focused builds and tests documented.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Overview
The file src/Analyzers/MSTest.Analyzers/RedundantTestMethodAttributeAnalyzer.cs has grown to 624 lines, making it harder to navigate and maintain. This task involves refactoring it into smaller, more focused files.
Current State
- File:
src/Analyzers/MSTest.Analyzers/RedundantTestMethodAttributeAnalyzer.cs - Size: 624 lines
- Language: C#
Structural Analysis
A single sealed DiagnosticAnalyzer (MSTEST0086) containing: descriptor/initialization (lines ~19-97), AnalyzeMethod and the central IsRedundant dispatcher (~69-175), and many per-attribute redundancy helpers: flag conditions / CI / ConditionIgnoreMessage (~183-268), Retry (~269-340), Ignore (~341-370), shared attribute/argument equivalence helpers (~371-441), DeploymentItem (~442-471), DependsOn (~472-544), ResourceLock (~545-575), and a nested KnownAttributeSymbols class (~576+).
Refactoring Strategy
Proposed File Splits
Based on the bounded structural sample (provisional), investigate these splits using partial class and confirm safety during implementation preflight:
-
RedundantTestMethodAttributeAnalyzer.cs- Contents: descriptor,
Initialize,AnalyzeMethod,IsRedundant,FindAttribute,FormatAttributeName - Responsibility: analyzer entry points and dispatch
- Contents: descriptor,
-
RedundantTestMethodAttributeAnalyzer.Conditions.cs- Contents: flag/CI/ConditionIgnoreMessage helpers,
TryGetAllowedValues,TryGetConditionMode - Responsibility: condition-attribute redundancy
- Contents: flag/CI/ConditionIgnoreMessage helpers,
-
RedundantTestMethodAttributeAnalyzer.RetryAndIgnore.cs- Contents: Retry and Ignore helpers, named-argument helpers
- Responsibility: Retry/Ignore redundancy
-
RedundantTestMethodAttributeAnalyzer.Dependencies.cs- Contents: DeploymentItem, DependsOn, ResourceLock helpers, and equivalence helpers (
HasEquivalentAttribute,AreArgumentsEquivalent,AreConstantsEquivalent) - Responsibility: dependency/resource attribute redundancy
- Contents: DeploymentItem, DependsOn, ResourceLock helpers, and equivalence helpers (
-
RedundantTestMethodAttributeAnalyzer.KnownAttributeSymbols.cs(if needed)- Contents: nested
KnownAttributeSymbols - Responsibility: symbol cache
- Contents: nested
Implementation Guidelines
- 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. - 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.
- 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.
- Move Before Modernizing: Move bodies unchanged first, one coherent responsibility at a time. Do not mix adjacent modernization or bug fixes into the split.
- Use Focused Checks: Run the smallest affected project/TFM builds and relevant tests (
MSTest.Analyzers.UnitTests) before and after each split. Add distinguishing equivalence cases where coverage is missing. Report exact checks and outcomes, including unavailable checks. Preserve UTF-8 BOM on new.csfiles. - 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.
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 · 25.7 AIC · ⌖ 0.584 AIC · ⊞ 7.3K · [◷]( · ◷)
- expires on Oct 30, 2026, 6:53 PM UTC
- Lingua principale
- C#
- Stelle
- 1.1k
- Fork
- 312
- Merge medio
- 11h 6m
- PR unite (30g)
- 383
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/testfx
-
The productive version of Microsoft.Testing.Extensions.HangDump must not reference to a preview version of Microsoft.Diagnostics.NETCore.ClientForse già presa @Evangelink l’ha presa 3 giorni fa. Apertaarea/dump external/other
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
microsoft/testfx#11981 · 5 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
type/automation type/tech-debt
Difficoltà 5/5 Più di una settimana Idoneità per principianti 5/100
I maintainer di solito rispondono entro 1 giorno
-
area/server-mode-jsonrpc
Difficoltà 5/5 Più di una settimana Idoneità per principianti 8/100
I maintainer di solito rispondono entro 1 giorno
-
[mutation-test-improver] Monthly Report 2026-10Forse già presa Una pull request collegata a questa issue è aperta o già unita. Apertatype/automation type/test-gap
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
microsoft/testfx#11704 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
testing type/automation type/test-gap
Difficoltà 2/5 1-3 ore Idoneità per principianti 20/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/testfx
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug] Dashboard renders attachment links that resolve to 404 when the FILES binding is absentApertabug 優先: 低
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
.NET area: storage bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Larson-Logan/medal-sync#61 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno