|
28 | 28 | using System.Threading.Tasks; |
29 | 29 | using System.Collections.ObjectModel; |
30 | 30 | using System.Collections; |
| 31 | +using System.Diagnostics; |
31 | 32 |
|
32 | 33 | namespace Microsoft.Windows.PowerShell.ScriptAnalyzer |
33 | 34 | { |
@@ -216,13 +217,19 @@ internal bool ParseProfile(object profileObject, PathIntrinsics path, IOutputWri |
216 | 217 | return true; |
217 | 218 | } |
218 | 219 |
|
219 | | - private bool TryAddingProfileItem( |
| 220 | + private bool AddProfileItem( |
220 | 221 | string key, |
221 | 222 | List<string> values, |
222 | 223 | List<string> severityList, |
223 | 224 | List<string> includeRuleList, |
224 | 225 | List<string> excludeRuleList) |
225 | 226 | { |
| 227 | + Debug.Assert(key != null); |
| 228 | + Debug.Assert(values != null); |
| 229 | + Debug.Assert(severityList != null); |
| 230 | + Debug.Assert(includeRuleList != null); |
| 231 | + Debug.Assert(excludeRuleList != null); |
| 232 | + |
226 | 233 | switch (key.ToLower()) |
227 | 234 | { |
228 | 235 | case "severity": |
@@ -317,7 +324,7 @@ private bool ParseProfileHashtable(Hashtable profile, PathIntrinsics path, IOutp |
317 | 324 | } |
318 | 325 | } |
319 | 326 |
|
320 | | - TryAddingProfileItem(key, values, severityList, includeRuleList, excludeRuleList); |
| 327 | + AddProfileItem(key, values, severityList, includeRuleList, excludeRuleList); |
321 | 328 |
|
322 | 329 | } |
323 | 330 |
|
@@ -437,7 +444,7 @@ private bool ParseProfileString(string profile, PathIntrinsics path, IOutputWrit |
437 | 444 |
|
438 | 445 | string key = (kvp.Item1 as StringConstantExpressionAst).Value.ToLower(); |
439 | 446 |
|
440 | | - if(!TryAddingProfileItem(key, rhsList, severityList, includeRuleList, excludeRuleList)) |
| 447 | + if(!AddProfileItem(key, rhsList, severityList, includeRuleList, excludeRuleList)) |
441 | 448 | { |
442 | 449 | writer.WriteError(new ErrorRecord( |
443 | 450 | new InvalidDataException(string.Format(CultureInfo.CurrentCulture, Strings.WrongKey, key, kvp.Item1.Extent.StartLineNumber, kvp.Item1.Extent.StartColumnNumber, profile)), |
|
0 commit comments