@@ -39,19 +39,19 @@ internal static string GetUniqueIdFromDiagnostic(Diagnostic diagnostic)
3939 Position end = diagnostic . Range . End ;
4040
4141 StringBuilder sb = new StringBuilder ( 256 )
42- . Append ( diagnostic . Source ?? "?" )
43- . Append ( '_' )
44- . Append ( diagnostic . Code ? . IsString ?? true ? diagnostic . Code ? . String : diagnostic . Code ? . Long . ToString ( ) )
45- . Append ( '_' )
46- . Append ( diagnostic . Severity ? . ToString ( ) ?? "?" )
47- . Append ( '_' )
48- . Append ( start . Line )
49- . Append ( ':' )
50- . Append ( start . Character )
51- . Append ( '-' )
52- . Append ( end . Line )
53- . Append ( ':' )
54- . Append ( end . Character ) ;
42+ . Append ( diagnostic . Source ?? "?" )
43+ . Append ( '_' )
44+ . Append ( diagnostic . Code ? . IsString ?? true ? diagnostic . Code ? . String : diagnostic . Code ? . Long . ToString ( ) )
45+ . Append ( '_' )
46+ . Append ( diagnostic . Severity ? . ToString ( ) ?? "?" )
47+ . Append ( '_' )
48+ . Append ( start . Line )
49+ . Append ( ':' )
50+ . Append ( start . Character )
51+ . Append ( '-' )
52+ . Append ( end . Line )
53+ . Append ( ':' )
54+ . Append ( end . Character ) ;
5555
5656 return sb . ToString ( ) ;
5757 }
@@ -60,7 +60,7 @@ internal static string GetUniqueIdFromDiagnostic(Diagnostic diagnostic)
6060 /// Defines the list of Script Analyzer rules to include by default if
6161 /// no settings file is specified.
6262 /// </summary>
63- private static readonly string [ ] s_defaultRules = {
63+ internal static readonly string [ ] s_defaultRules = {
6464 "PSAvoidAssignmentToAutomaticVariable" ,
6565 "PSUseToExportFieldsInManifest" ,
6666 "PSMisleadingBacktick" ,
@@ -141,7 +141,7 @@ public void StartScriptDiagnostics(ScriptFile[] filesToAnalyze)
141141 // If there's an existing task, we want to cancel it here;
142142 CancellationTokenSource cancellationSource = new ( ) ;
143143 CancellationTokenSource oldTaskCancellation = Interlocked . Exchange ( ref _diagnosticsCancellationTokenSource , cancellationSource ) ;
144- if ( oldTaskCancellation != null )
144+ if ( oldTaskCancellation is not null )
145145 {
146146 try
147147 {
@@ -194,7 +194,7 @@ public Task<string> FormatAsync(string scriptFileContents, Hashtable formatSetti
194194 /// <returns></returns>
195195 public async Task < string > GetCommentHelpText ( string functionText , string helpLocation , bool forBlockComment )
196196 {
197- if ( AnalysisEngine == null )
197+ if ( AnalysisEngine is null )
198198 {
199199 return null ;
200200 }
@@ -215,7 +215,7 @@ public async Task<string> GetCommentHelpText(string functionText, string helpLoc
215215 /// Get the most recent corrections computed for a given script file.
216216 /// </summary>
217217 /// <param name="uri">The URI string of the file to get code actions for.</param>
218- /// <returns>A threadsafe readonly dictionary of the code actions of the particular file.</returns>
218+ /// <returns>A thread-safe readonly dictionary of the code actions of the particular file.</returns>
219219 public async Task < IReadOnlyDictionary < string , IEnumerable < MarkerCorrection > > > GetMostRecentCodeActionsForFileAsync ( DocumentUri uri )
220220 {
221221 if ( ! _workspaceService . TryGetFile ( uri , out ScriptFile file )
@@ -252,8 +252,8 @@ public void OnConfigurationUpdated(object _, LanguageServerSettings settings)
252252
253253 private void EnsureEngineSettingsCurrent ( )
254254 {
255- if ( _analysisEngineLazy == null
256- || ( _pssaSettingsFilePath != null
255+ if ( _analysisEngineLazy is null
256+ || ( _pssaSettingsFilePath is not null
257257 && ! File . Exists ( _pssaSettingsFilePath ) ) )
258258 {
259259 InitializeAnalysisEngineToCurrentSettings ( ) ;
@@ -264,7 +264,7 @@ private void InitializeAnalysisEngineToCurrentSettings()
264264 {
265265 // We may be triggered after the lazy factory is set,
266266 // but before it's been able to instantiate
267- if ( _analysisEngineLazy == null )
267+ if ( _analysisEngineLazy is null )
268268 {
269269 _analysisEngineLazy = new Lazy < PssaCmdletAnalysisEngine > ( InstantiateAnalysisEngine ) ;
270270 return ;
@@ -327,7 +327,7 @@ private bool TryFindSettingsFile(out string settingsFilePath)
327327
328328 settingsFilePath = _workspaceService ? . ResolveWorkspacePath ( configuredPath ) ;
329329
330- if ( settingsFilePath == null
330+ if ( settingsFilePath is null
331331 || ! File . Exists ( settingsFilePath ) )
332332 {
333333 _logger . LogInformation ( $ "Unable to find PSSA settings file at '{ configuredPath } '. Loading default rules.") ;
0 commit comments