@@ -21,15 +21,17 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic
21
21
{
22
22
public class Settings
23
23
{
24
+ private string filePath ;
24
25
private List < string > includeRules ;
25
26
private List < string > excludeRules ;
26
27
private List < string > severities ;
27
28
private Dictionary < string , Dictionary < string , object > > ruleArguments ;
28
29
29
- public IEnumerable < string > IncludeRules { get { return includeRules ; } }
30
- public IEnumerable < string > ExcludeRules { get { return excludeRules ; } }
31
- public IEnumerable < string > Severity { get { return severities ; } }
32
- public Dictionary < string , Dictionary < string , object > > RuleArguments { get { return ruleArguments ; } }
30
+ public string FilePath { get { return filePath ; } }
31
+ public IEnumerable < string > IncludeRules { get { return includeRules ; } }
32
+ public IEnumerable < string > ExcludeRules { get { return excludeRules ; } }
33
+ public IEnumerable < string > Severity { get { return severities ; } }
34
+ public Dictionary < string , Dictionary < string , object > > RuleArguments { get { return ruleArguments ; } }
33
35
34
36
public Settings ( object settings , Func < string , string > presetResolver )
35
37
{
@@ -38,6 +40,10 @@ public Settings(object settings, Func<string, string> presetResolver)
38
40
throw new ArgumentNullException ( "settings" ) ;
39
41
}
40
42
43
+ includeRules = new List < string > ( ) ;
44
+ excludeRules = new List < string > ( ) ;
45
+ severities = new List < string > ( ) ;
46
+ ruleArguments = new Dictionary < string , Dictionary < string , object > > ( StringComparer . OrdinalIgnoreCase ) ;
41
47
var settingsFilePath = settings as string ;
42
48
43
49
//it can either be a preset or path to a file or a hashtable
@@ -54,6 +60,7 @@ public Settings(object settings, Func<string, string> presetResolver)
54
60
55
61
if ( File . Exists ( settingsFilePath ) )
56
62
{
63
+ filePath = settingsFilePath ;
57
64
parseSettingsFile ( settingsFilePath ) ;
58
65
}
59
66
else
@@ -92,6 +99,7 @@ private Dictionary<string, object> GetDictionaryFromHashtable(Hashtable hashtabl
92
99
string key = obj as string ;
93
100
if ( key == null )
94
101
{
102
+ // TODO localize
95
103
throw new InvalidDataException ( "key not string" ) ;
96
104
// writer.WriteError(
97
105
// new ErrorRecord(
0 commit comments