File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -22,5 +22,10 @@ public enum RuleSeverity : uint
22
22
/// ERROR: This warning is likely to cause a problem or does not follow PowerShell's required guidelines.
23
23
/// </summary>
24
24
Error = 2 ,
25
+
26
+ /// <summary>
27
+ /// ERROR: This diagnostic is caused by an actual parsing error, and is generated only by the engine.
28
+ /// </summary>
29
+ ParseError = 3 ,
25
30
} ;
26
31
}
Original file line number Diff line number Diff line change @@ -1526,8 +1526,9 @@ public IEnumerable<DiagnosticRecord> AnalyzeScriptDefinition(string scriptDefini
1526
1526
1527
1527
var relevantParseErrors = RemoveTypeNotFoundParseErrors ( errors , out List < DiagnosticRecord > diagnosticRecords ) ;
1528
1528
1529
- // Add parse errors first!
1530
- if ( relevantParseErrors != null )
1529
+ int emitParseErrors = severity == null ? 1 : severity . Count ( item => item == "ParseError" ) ;
1530
+ // Add parse errors first if requested!
1531
+ if ( relevantParseErrors != null && emitParseErrors == 1 )
1531
1532
{
1532
1533
List < DiagnosticRecord > results = new List < DiagnosticRecord > ( ) ;
1533
1534
foreach ( var parseError in relevantParseErrors )
@@ -1878,8 +1879,9 @@ private IEnumerable<DiagnosticRecord> AnalyzeFile(string filePath)
1878
1879
#endif //!PSV3
1879
1880
var relevantParseErrors = RemoveTypeNotFoundParseErrors ( errors , out diagnosticRecords ) ;
1880
1881
1881
- // First, add all parse errors
1882
- if ( relevantParseErrors != null )
1882
+ // First, add all parse errors if they've been requested
1883
+ int emitParseErrors = severity == null ? 1 : severity . Count ( item => item == "ParseError" ) ;
1884
+ if ( relevantParseErrors != null && emitParseErrors == 1 )
1883
1885
{
1884
1886
List < DiagnosticRecord > results = new List < DiagnosticRecord > ( ) ;
1885
1887
foreach ( var parseError in relevantParseErrors )
You can’t perform that action at this time.
0 commit comments