Skip to content

Commit cb30c5b

Browse files
committed
Run roslynator fix
With `--ignored-diagnostics CA1067 CS0659 VSTHRD002 VSTHRD100 VSTHRD103 VSTHRD114 VSTHRD200 xUnit1004`
1 parent 44387b3 commit cb30c5b

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

src/PowerShellEditorServices/Extensions/EditorFileRanges.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static FileScriptPosition FromOffset(FileContext file, int offset)
3737

3838
if (offset >= fileText.Length)
3939
{
40-
throw new ArgumentException(nameof(offset), "Offset greater than file length");
40+
throw new ArgumentException("Offset greater than file length", nameof(offset));
4141
}
4242

4343
int lastLineOffset = -1;

src/PowerShellEditorServices/Services/Analysis/AnalysisService.cs

+7-7
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@ internal static string GetUniqueIdFromDiagnostic(Diagnostic diagnostic)
3939

4040
StringBuilder sb = new StringBuilder(256)
4141
.Append(diagnostic.Source ?? "?")
42-
.Append("_")
42+
.Append('_')
4343
.Append(diagnostic.Code?.IsString ?? true ? diagnostic.Code?.String : diagnostic.Code?.Long.ToString())
44-
.Append("_")
44+
.Append('_')
4545
.Append(diagnostic.Severity?.ToString() ?? "?")
46-
.Append("_")
46+
.Append('_')
4747
.Append(start.Line)
48-
.Append(":")
48+
.Append(':')
4949
.Append(start.Character)
50-
.Append("-")
50+
.Append('-')
5151
.Append(end.Line)
52-
.Append(":")
52+
.Append(':')
5353
.Append(end.Character);
5454

5555
string id = sb.ToString();
@@ -210,7 +210,7 @@ public async Task<string> GetCommentHelpText(string functionText, string helpLoc
210210

211211
if (analysisResults.Length == 0
212212
|| analysisResults[0]?.Correction?.Edits == null
213-
|| analysisResults[0].Correction.Edits.Count() == 0)
213+
|| analysisResults[0].Correction.Edits.Length == 0)
214214
{
215215
return null;
216216
}

src/PowerShellEditorServices/Services/PowerShell/Handlers/ExpandAliasHandler.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function __Expand-Alias {
7373

7474
return new ExpandAliasResult
7575
{
76-
Text = result.First()
76+
Text = result[0]
7777
};
7878
}
7979
}

src/PowerShellEditorServices/Services/Template/TemplateService.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public async Task<bool> ImportPlasterIfInstalledAsync()
7272

7373
_logger.LogTrace("Checking if Plaster is installed...");
7474

75-
PSObject moduleObject = (await _executionService.ExecutePSCommandAsync<PSObject>(psCommand, CancellationToken.None).ConfigureAwait(false)).First();
75+
PSObject moduleObject = (await _executionService.ExecutePSCommandAsync<PSObject>(psCommand, CancellationToken.None).ConfigureAwait(false))[0];
7676

7777
isPlasterInstalled = moduleObject != null;
7878
string installedQualifier =
@@ -135,7 +135,7 @@ public async Task<TemplateDetails[]> GetAvailableTemplatesAsync(
135135
psCommand,
136136
CancellationToken.None).ConfigureAwait(false);
137137

138-
_logger.LogTrace($"Found {templateObjects.Count()} Plaster templates");
138+
_logger.LogTrace($"Found {templateObjects.Count} Plaster templates");
139139

140140
return
141141
templateObjects

test/PowerShellEditorServices.Test/Language/TokenOperationsTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public void LaguageServiceFindsFoldablRegionsWithCRLF() {
181181
// The Foldable regions should be the same regardless of line ending type
182182
// Enforce CRLF line endings, if none exist
183183
string testString = allInOneScript;
184-
if (testString.IndexOf("\r\n") == -1) {
184+
if (!testString.Contains("\r\n", StringComparison.CurrentCulture)) {
185185
testString = testString.Replace("\n", "\r\n");
186186
}
187187
// Ensure that there are CRLF characters in the string

test/PowerShellEditorServices.Test/Session/WorkspaceTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public void CanRecurseDirectoryTreeWithLimit()
128128
ignoreReparsePoints: s_defaultIgnoreReparsePoints
129129
);
130130

131-
Assert.Equal(1, fileList.Count);
131+
Assert.Single(fileList);
132132
Assert.Equal(Path.Combine(workspace.WorkspacePath, "rootfile.ps1"), fileList[0]);
133133
}
134134

0 commit comments

Comments
 (0)