@@ -10,13 +10,13 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer
10
10
{
11
11
public class Formatter
12
12
{
13
- // TODO add a method that takes range parameter
14
13
public static string Format < TCmdlet > (
15
14
string scriptDefinition ,
16
15
Settings settings ,
17
16
Range range ,
18
17
TCmdlet cmdlet ) where TCmdlet : PSCmdlet , IOutputWriter
19
18
{
19
+ // todo add argument check
20
20
Helper . Instance = new Helper ( cmdlet . SessionState . InvokeCommand , cmdlet ) ;
21
21
Helper . Instance . Initialize ( ) ;
22
22
@@ -52,15 +52,11 @@ public static string Format<TCmdlet>(
52
52
53
53
private static Settings GetCurrentSettings ( Settings settings , string rule )
54
54
{
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
+ } ) ;
64
60
}
65
61
}
66
62
}
0 commit comments