2121using System . Globalization ;
2222using System . Management . Automation ;
2323using System . Text ;
24+ using System . IO ;
2425
2526namespace Microsoft . Windows . PowerShell . ScriptAnalyzer . BuiltinRules
2627{
@@ -182,7 +183,13 @@ public ViolationFinder(HashSet<string> exportedFunctions, bool exportedOnly) : t
182183 this . useFunctionWhitelist = exportedOnly ;
183184 }
184185
185- public IEnumerable < FunctionDefinitionAst > FunctionDefinitionAsts { get { return functionDefinitionAsts ; } }
186+ public IEnumerable < FunctionDefinitionAst > FunctionDefinitionAsts
187+ {
188+ get
189+ {
190+ return functionDefinitionAsts ;
191+ }
192+ }
186193
187194 /// <summary>
188195 /// Visit function and checks that it has comment help
@@ -256,7 +263,8 @@ public override string ToString()
256263 }
257264
258265 // todo remove code duplication
259- public string ToSnippetString ( ) {
266+ public string ToSnippetString ( )
267+ {
260268 return ToString ( true ) ;
261269 }
262270
@@ -276,15 +284,17 @@ private string ToString(bool snippetify)
276284 return sb . ToString ( ) ;
277285 }
278286
279- private class Counter {
287+ private class Counter
288+ {
280289 int ? count ;
281290
282291 public Counter ( int ? start )
283292 {
284293 count = start ;
285294 }
286295
287- public int ? Next ( ) {
296+ public int ? Next ( )
297+ {
288298 return count . HasValue ? count ++ : null ;
289299 }
290300 }
@@ -340,20 +350,12 @@ public override string ToString()
340350
341351 public override string ToString ( int ? tabStop )
342352 {
343- var sb = new StringBuilder ( ) ;
344- sb . Append ( "." ) . Append ( Name . ToUpper ( ) ) . Append ( " " ) . AppendLine ( ParameterName ) ;
345- if ( ! String . IsNullOrWhiteSpace ( Description ) )
346- {
347- sb . Append ( Snippetify ( tabStop , Description ) ) ;
348- }
349-
350- return sb . ToString ( ) ;
353+ // todo replace with String.GetLines() extension once it is available
354+ var lines = base . ToString ( tabStop ) . Split ( '\n ' ) . Select ( l => l . Trim ( '\r ' ) ) . ToArray ( ) ;
355+ lines [ 0 ] = $ "{ lines [ 0 ] } { ParameterName } ";
356+ return String . Join ( Environment . NewLine , lines ) ;
351357 }
352358 }
353359 }
354360 }
355361}
356-
357-
358-
359-
0 commit comments