@@ -10,13 +10,13 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer
1010{
1111 public class Formatter
1212 {
13- // TODO add a method that takes range parameter
1413 public static string Format < TCmdlet > (
1514 string scriptDefinition ,
1615 Settings settings ,
1716 Range range ,
1817 TCmdlet cmdlet ) where TCmdlet : PSCmdlet , IOutputWriter
1918 {
19+ // todo add argument check
2020 Helper . Instance = new Helper ( cmdlet . SessionState . InvokeCommand , cmdlet ) ;
2121 Helper . Instance . Initialize ( ) ;
2222
@@ -52,15 +52,11 @@ public static string Format<TCmdlet>(
5252
5353 private static Settings GetCurrentSettings ( Settings settings , string rule )
5454 {
55- var currentSettingsHashtable = new Hashtable ( ) ;
56- currentSettingsHashtable . Add ( "IncludeRules" , new string [ ] { rule } ) ;
57-
58- var ruleSettings = new Hashtable ( ) ;
59- ruleSettings . Add ( rule , new Hashtable ( settings . RuleArguments [ rule ] ) ) ;
60- currentSettingsHashtable . Add ( "Rules" , ruleSettings ) ;
61-
62- var currentSettings = new Settings ( currentSettingsHashtable ) ;
63- return currentSettings ;
55+ return new Settings ( new Hashtable ( )
56+ {
57+ { "IncludeRules" , new string [ ] { rule } } ,
58+ { "Rules" , new Hashtable ( ) { { rule , new Hashtable ( settings . RuleArguments [ rule ] ) } } }
59+ } ) ;
6460 }
6561 }
6662}
0 commit comments