@@ -55,7 +55,7 @@ public class AnalysisService : IDisposable
55
55
/// <summary>
56
56
/// An empty script marker result to return when no script markers can be returned.
57
57
/// </summary>
58
- private static readonly ScriptFileMarker [ ] s_emptyScriptMarkerResult = new ScriptFileMarker [ 0 ] ;
58
+ private static readonly List < ScriptFileMarker > s_emptyScriptMarkerResult = new List < ScriptFileMarker > ( ) ;
59
59
60
60
private static readonly string [ ] s_emptyGetRuleResult = new string [ 0 ] ;
61
61
@@ -266,7 +266,7 @@ public static Hashtable GetPSSASettingsHashtable(IDictionary<string, Hashtable>
266
266
/// </summary>
267
267
/// <param name="file">The ScriptFile which will be analyzed for semantic markers.</param>
268
268
/// <returns>An array of ScriptFileMarkers containing semantic analysis results.</returns>
269
- public async Task < ScriptFileMarker [ ] > GetSemanticMarkersAsync ( ScriptFile file )
269
+ public async Task < List < ScriptFileMarker > > GetSemanticMarkersAsync ( ScriptFile file )
270
270
{
271
271
return await GetSemanticMarkersAsync < string > ( file , ActiveRules , SettingsPath ) ;
272
272
}
@@ -277,7 +277,7 @@ public async Task<ScriptFileMarker[]> GetSemanticMarkersAsync(ScriptFile file)
277
277
/// <param name="file">The ScriptFile to be analyzed.</param>
278
278
/// <param name="settings">ScriptAnalyzer settings</param>
279
279
/// <returns></returns>
280
- public async Task < ScriptFileMarker [ ] > GetSemanticMarkersAsync ( ScriptFile file , Hashtable settings )
280
+ public async Task < List < ScriptFileMarker > > GetSemanticMarkersAsync ( ScriptFile file , Hashtable settings )
281
281
{
282
282
return await GetSemanticMarkersAsync < Hashtable > ( file , null , settings ) ;
283
283
}
@@ -288,7 +288,7 @@ public async Task<ScriptFileMarker[]> GetSemanticMarkersAsync(ScriptFile file, H
288
288
/// <param name="scriptContent">The script content to be analyzed.</param>
289
289
/// <param name="settings">ScriptAnalyzer settings</param>
290
290
/// <returns></returns>
291
- public async Task < ScriptFileMarker [ ] > GetSemanticMarkersAsync (
291
+ public async Task < List < ScriptFileMarker > > GetSemanticMarkersAsync (
292
292
string scriptContent ,
293
293
Hashtable settings )
294
294
{
@@ -379,7 +379,7 @@ public async Task<string> FormatAsync(
379
379
380
380
#region Private Methods
381
381
382
- private async Task < ScriptFileMarker [ ] > GetSemanticMarkersAsync < TSettings > (
382
+ private async Task < List < ScriptFileMarker > > GetSemanticMarkersAsync < TSettings > (
383
383
ScriptFile file ,
384
384
string [ ] rules ,
385
385
TSettings settings ) where TSettings : class
@@ -398,7 +398,7 @@ private async Task<ScriptFileMarker[]> GetSemanticMarkersAsync<TSettings>(
398
398
}
399
399
}
400
400
401
- private async Task < ScriptFileMarker [ ] > GetSemanticMarkersAsync < TSettings > (
401
+ private async Task < List < ScriptFileMarker > > GetSemanticMarkersAsync < TSettings > (
402
402
string scriptContent ,
403
403
string [ ] rules ,
404
404
TSettings settings ) where TSettings : class
@@ -407,7 +407,7 @@ private async Task<ScriptFileMarker[]> GetSemanticMarkersAsync<TSettings>(
407
407
&& ( rules != null || settings != null ) )
408
408
{
409
409
var scriptFileMarkers = await GetDiagnosticRecordsAsync ( scriptContent , rules , settings ) ;
410
- return scriptFileMarkers . Select ( ScriptFileMarker . FromDiagnosticRecord ) . ToArray ( ) ;
410
+ return scriptFileMarkers . Select ( ScriptFileMarker . FromDiagnosticRecord ) . ToList ( ) ;
411
411
}
412
412
else
413
413
{
@@ -514,7 +514,9 @@ private async Task<PSObject[]> GetDiagnosticRecordsAsync<TSettings>(
514
514
new Dictionary < string , object >
515
515
{
516
516
{ "ScriptDefinition" , scriptContent } ,
517
- { settingParameter , settingArgument }
517
+ { settingParameter , settingArgument } ,
518
+ // We ignore ParseErrors from PSSA because we already send them when we parse the file.
519
+ { "Severity" , new [ ] { ScriptFileMarkerLevel . Error , ScriptFileMarkerLevel . Information , ScriptFileMarkerLevel . Warning } }
518
520
} ) ;
519
521
520
522
diagnosticRecords = result ? . Output ;
0 commit comments