Skip to content

Commit a720174

Browse files
committed
Updated code fix as per CR
1 parent 733cd70 commit a720174

2 files changed

Lines changed: 6 additions & 15 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/DocumentationRules/PropertySummaryDocumentationCodeFixProvider.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,7 @@ private static async Task<Document> GetTransformedDocumentAsync(Document documen
6262
var textElement = (XmlTextSyntax)summaryElement.Content.FirstOrDefault();
6363
if (textElement == null)
6464
{
65-
var newTextToken = SyntaxFactory.XmlTextLiteral(SyntaxTriviaList.Empty, "the value", "the value", SyntaxTriviaList.Empty);
66-
textElement = SyntaxFactory.XmlText(SyntaxTokenList.Create(newTextToken));
67-
var updatedReturns = summaryElement.WithContent(XmlSyntaxFactory.List(textElement));
68-
syntaxRoot = syntaxRoot.ReplaceNode(summaryElement, updatedReturns);
65+
return document;
6966
}
7067

7168
var textToken = textElement.TextTokens.First(token => token.IsKind(SyntaxKind.XmlTextLiteralToken));

StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1623UnitTests.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -169,20 +169,14 @@ public int Property
169169
}
170170
}";
171171

172-
var fixedTestCode = @"public class ClassName
173-
{
174-
/// <summary>Gets the value</summary>
175-
public int Property
176-
{
177-
get;
178-
}
179-
}";
180-
181172
var expected = this.CSharpDiagnostic(PropertySummaryDocumentationAnalyzer.SA1623Descriptor).WithLocation(4, 16).WithArguments("Gets");
182173

183174
await this.VerifyCSharpDiagnosticAsync(testCode, expected, CancellationToken.None).ConfigureAwait(false);
184-
await this.VerifyCSharpDiagnosticAsync(fixedTestCode, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
185-
await this.VerifyCSharpFixAsync(testCode, fixedTestCode).ConfigureAwait(false);
175+
176+
// Intentionally do not provide a code fix: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/1957#discussion_r47703520
177+
//// await this.VerifyCSharpDiagnosticAsync(fixedTestCode, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
178+
179+
await this.VerifyCSharpFixAsync(testCode, testCode).ConfigureAwait(false);
186180
}
187181

188182
/// <inheritdoc/>

0 commit comments

Comments
 (0)