Skip to content

Commit 82a277f

Browse files
author
Kapil Borle
committed
Update Formatter.GetCurrentSettings implementation
1 parent db12b5e commit 82a277f

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

Engine/Formatter.cs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)