@@ -39,19 +39,19 @@ internal static string GetUniqueIdFromDiagnostic(Diagnostic diagnostic)
39
39
Position end = diagnostic . Range . End ;
40
40
41
41
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 ) ;
55
55
56
56
return sb . ToString ( ) ;
57
57
}
@@ -60,7 +60,7 @@ internal static string GetUniqueIdFromDiagnostic(Diagnostic diagnostic)
60
60
/// Defines the list of Script Analyzer rules to include by default if
61
61
/// no settings file is specified.
62
62
/// </summary>
63
- private static readonly string [ ] s_defaultRules = {
63
+ internal static readonly string [ ] s_defaultRules = {
64
64
"PSAvoidAssignmentToAutomaticVariable" ,
65
65
"PSUseToExportFieldsInManifest" ,
66
66
"PSMisleadingBacktick" ,
@@ -141,7 +141,7 @@ public void StartScriptDiagnostics(ScriptFile[] filesToAnalyze)
141
141
// If there's an existing task, we want to cancel it here;
142
142
CancellationTokenSource cancellationSource = new ( ) ;
143
143
CancellationTokenSource oldTaskCancellation = Interlocked . Exchange ( ref _diagnosticsCancellationTokenSource , cancellationSource ) ;
144
- if ( oldTaskCancellation != null )
144
+ if ( oldTaskCancellation is not null )
145
145
{
146
146
try
147
147
{
@@ -194,7 +194,7 @@ public Task<string> FormatAsync(string scriptFileContents, Hashtable formatSetti
194
194
/// <returns></returns>
195
195
public async Task < string > GetCommentHelpText ( string functionText , string helpLocation , bool forBlockComment )
196
196
{
197
- if ( AnalysisEngine == null )
197
+ if ( AnalysisEngine is null )
198
198
{
199
199
return null ;
200
200
}
@@ -215,7 +215,7 @@ public async Task<string> GetCommentHelpText(string functionText, string helpLoc
215
215
/// Get the most recent corrections computed for a given script file.
216
216
/// </summary>
217
217
/// <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>
219
219
public async Task < IReadOnlyDictionary < string , IEnumerable < MarkerCorrection > > > GetMostRecentCodeActionsForFileAsync ( DocumentUri uri )
220
220
{
221
221
if ( ! _workspaceService . TryGetFile ( uri , out ScriptFile file )
@@ -252,8 +252,8 @@ public void OnConfigurationUpdated(object _, LanguageServerSettings settings)
252
252
253
253
private void EnsureEngineSettingsCurrent ( )
254
254
{
255
- if ( _analysisEngineLazy == null
256
- || ( _pssaSettingsFilePath != null
255
+ if ( _analysisEngineLazy is null
256
+ || ( _pssaSettingsFilePath is not null
257
257
&& ! File . Exists ( _pssaSettingsFilePath ) ) )
258
258
{
259
259
InitializeAnalysisEngineToCurrentSettings ( ) ;
@@ -264,7 +264,7 @@ private void InitializeAnalysisEngineToCurrentSettings()
264
264
{
265
265
// We may be triggered after the lazy factory is set,
266
266
// but before it's been able to instantiate
267
- if ( _analysisEngineLazy == null )
267
+ if ( _analysisEngineLazy is null )
268
268
{
269
269
_analysisEngineLazy = new Lazy < PssaCmdletAnalysisEngine > ( InstantiateAnalysisEngine ) ;
270
270
return ;
@@ -327,7 +327,7 @@ private bool TryFindSettingsFile(out string settingsFilePath)
327
327
328
328
settingsFilePath = _workspaceService ? . ResolveWorkspacePath ( configuredPath ) ;
329
329
330
- if ( settingsFilePath == null
330
+ if ( settingsFilePath is null
331
331
|| ! File . Exists ( settingsFilePath ) )
332
332
{
333
333
_logger . LogInformation ( $ "Unable to find PSSA settings file at '{ configuredPath } '. Loading default rules.") ;
0 commit comments