@@ -12,6 +12,7 @@ namespace AspNetCoreAnalyzers.Tests.Documentation
1212 using System . Text ;
1313 using Gu . Roslyn . AnalyzerExtensions ;
1414 using Gu . Roslyn . Asserts ;
15+ using Gu . Roslyn . CodeFixExtensions ;
1516 using Microsoft . CodeAnalysis ;
1617 using Microsoft . CodeAnalysis . Diagnostics ;
1718 using NUnit . Framework ;
@@ -131,37 +132,37 @@ public void Index()
131132 private static string CreateStub ( DescriptorInfo descriptorInfo )
132133 {
133134 var descriptor = descriptorInfo . Descriptor ;
134- var stub = @"# {ID }
135- ## ADD TITLE HERE
135+ var stub = $ @ "# { descriptor . Id }
136+ ## { descriptor . Title . ToString ( CultureInfo . InvariantCulture ) }
136137
137138<!-- start generated table -->
138139<table>
139140 <tr>
140141 <td>CheckId</td>
141- <td>{ID }</td>
142+ <td>{ descriptor . Id } </td>
142143 </tr>
143144 <tr>
144145 <td>Severity</td>
145- <td>{SEVERITY }</td>
146+ <td>{ descriptor . DefaultSeverity . ToString ( ) } </td>
146147 </tr>
147148 <tr>
148149 <td>Enabled</td>
149- <td>{ENABLED }</td>
150+ <td>{ ( descriptor . IsEnabledByDefault ? "True" : "False" ) } </td>
150151 </tr>
151152 <tr>
152153 <td>Category</td>
153- <td>{CATEGORY }</td>
154+ <td>{ descriptor . Category } </td>
154155 </tr>
155156 <tr>
156157 <td>Code</td>
157- <td><a href=""{ URL} "">{ TYPENAME} </a></td>
158+ <td><a href=""< URL> "">< TYPENAME> </a></td>
158159 </tr>
159160</table>
160161<!-- end generated table -->
161162
162163## Description
163164
164- ADD DESCRIPTION HERE
165+ { descriptor . Description . ToString ( CultureInfo . InvariantCulture ) }
165166
166167## Motivation
167168
@@ -180,35 +181,28 @@ ADD HOW TO FIX VIOLATIONS HERE
180181
181182### Via #pragma directive.
182183```C#
183- #pragma warning disable {ID } // {TITLE }
184+ #pragma warning disable { descriptor . Id } // { descriptor . Title . ToString ( CultureInfo . InvariantCulture ) }
184185Code violating the rule here
185- #pragma warning restore {ID } // {TITLE }
186+ #pragma warning restore { descriptor . Id } // { descriptor . Title . ToString ( CultureInfo . InvariantCulture ) }
186187```
187188
188189Or put this at the top of the file to disable all instances.
189190```C#
190- #pragma warning disable {ID } // {TITLE }
191+ #pragma warning disable { descriptor . Id } // { descriptor . Title . ToString ( CultureInfo . InvariantCulture ) }
191192```
192193
193194### Via attribute `[SuppressMessage]`.
194195
195196```C#
196- [System.Diagnostics.CodeAnalysis.SuppressMessage(""{CATEGORY }"",
197- ""{ID }:{TITLE }"",
197+ [System.Diagnostics.CodeAnalysis.SuppressMessage(""{ descriptor . Category } "",
198+ ""{ descriptor . Id } :{ descriptor . Title . ToString ( CultureInfo . InvariantCulture ) } "",
198199 Justification = ""Reason..."")]
199200```
200- <!-- end generated config severity -->"
201- . AssertReplace ( "{ID}" , descriptor . Id )
202- . AssertReplace ( "## ADD TITLE HERE" , $ "## { descriptor . Title . ToString ( CultureInfo . InvariantCulture ) } ")
203- . AssertReplace ( "{SEVERITY}" , descriptor . DefaultSeverity . ToString ( ) )
204- . AssertReplace ( "{ENABLED}" , descriptor . IsEnabledByDefault ? "true" : "false" )
205- . AssertReplace ( "{CATEGORY}" , descriptor . Category )
206- . AssertReplace ( "ADD DESCRIPTION HERE" , descriptor . Description . ToString ( CultureInfo . InvariantCulture ) )
207- . AssertReplace ( "{TITLE}" , descriptor . Title . ToString ( CultureInfo . InvariantCulture ) ) ;
201+ <!-- end generated config severity -->" ;
208202 if ( Analyzers . Count ( x => x . SupportedDiagnostics . Any ( d => d . Id == descriptor . Id ) ) == 1 )
209203 {
210- return stub . AssertReplace ( "{ TYPENAME} " , descriptorInfo . Analyzer . GetType ( ) . Name )
211- . AssertReplace ( "{ URL} " , descriptorInfo . CodeFileUri ) ;
204+ return stub . AssertReplace ( "< TYPENAME> " , descriptorInfo . Analyzer . GetType ( ) . Name )
205+ . AssertReplace ( "< URL> " , descriptorInfo . CodeFileUri ) ;
212206 }
213207
214208 var builder = StringBuilderPool . Borrow ( ) ;
0 commit comments