Skip to content

Commit cf69a05

Browse files
authored
Merge pull request #1356 from github/dylan-smith/fix-linter
Fix broken build / linter errors
2 parents f9ee191 + 95cb2aa commit cf69a05

15 files changed

+33
-45
lines changed

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "8.0.404",
3+
"version": "8.0.410",
44
"rollForward": "minor"
55
}
66
}

src/OctoshiftCLI.Tests/Octoshift/Services/AdoApiTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ public async Task AddRepoToBoardsGithubConnection_Should_Send_Correct_Payload()
455455
}
456456
};
457457

458-
await sut.AddRepoToBoardsGithubConnection(ADO_ORG, ADO_TEAM_PROJECT, connectionId, connectionName, endpointId, new List<string>() { ADO_REPO, repo2 });
458+
await sut.AddRepoToBoardsGithubConnection(ADO_ORG, ADO_TEAM_PROJECT, connectionId, connectionName, endpointId, [ADO_REPO, repo2]);
459459

460460
_mockAdoClient.Verify(m => m.PostAsync(endpoint, It.Is<object>(y => y.ToJson() == payload.ToJson())).Result);
461461
}

src/OctoshiftCLI.Tests/Octoshift/Services/CodeScanningAlertServiceTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public async Task MigrateAnalyses_Migrate_Multiple_Analysis()
135135
var processingStatus = new SarifProcessingStatus
136136
{
137137
Status = SarifProcessingStatus.Complete,
138-
Errors = new Collection<string>()
138+
Errors = []
139139
};
140140

141141
_mockSourceGithubApi.Setup(x => x.GetCodeScanningAnalysisForRepository(SOURCE_ORG, SOURCE_REPO, "main")).ReturnsAsync(new[] { analysis1, analysis2 });
@@ -219,7 +219,7 @@ public async Task MigrateAnalyses_Skips_Analysis_That_Exist_On_Target_By_Count()
219219
const string sarifResponse2 = "SARIF_RESPONSE_2";
220220
const string sarifResponse3 = "SARIF_RESPONSE_3";
221221
var processingStatus =
222-
new SarifProcessingStatus { Status = SarifProcessingStatus.Complete, Errors = new Collection<string>() };
222+
new SarifProcessingStatus { Status = SarifProcessingStatus.Complete, Errors = [] };
223223

224224
_mockSourceGithubApi.Setup(x => x.GetCodeScanningAnalysisForRepository(SOURCE_ORG, SOURCE_REPO, "main")).ReturnsAsync(new[] { analysis1, analysis2, analysis3 });
225225
_mockTargetGithubApi.Setup(x => x.GetCodeScanningAnalysisForRepository(TARGET_ORG, TARGET_REPO, "main")).ReturnsAsync(new[] { analysis1 });
@@ -898,7 +898,7 @@ public async Task MigrateAlerts_Skips_An_Analysis_When_SARIF_Report_Not_Found()
898898
var processingStatus = new SarifProcessingStatus
899899
{
900900
Status = SarifProcessingStatus.Complete,
901-
Errors = new Collection<string>()
901+
Errors = []
902902
};
903903

904904
_mockSourceGithubApi.Setup(x => x.GetCodeScanningAnalysisForRepository(SOURCE_ORG, SOURCE_REPO, "main")).ReturnsAsync(new[] { analysis1, analysis2 });

src/OctoshiftCLI.Tests/Octoshift/Services/GithubApiTests.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2842,17 +2842,6 @@ async IAsyncEnumerable<JToken> GetAllPages()
28422842
location.Path.Should().Be((string)expectedData["details"]["path"]);
28432843
}
28442844

2845-
private void AssertSecretScanningData(GithubSecretScanningAlert actual, JToken expectedData)
2846-
{
2847-
actual.Number.Should().Be((int)expectedData["number"]);
2848-
actual.State.Should().Be((string)expectedData["state"]);
2849-
actual.SecretType.Should().Be((string)expectedData["secret_type"]);
2850-
actual.Resolution.Should().Be((string)expectedData["resolution"]);
2851-
actual.Secret.Should().Be((string)expectedData["secret"]);
2852-
actual.ResolutionComment.Should().Be((string)expectedData["resolution_comment"]);
2853-
actual.ResolverName.Should().Be((string)expectedData["resolved_by"]["login"]);
2854-
}
2855-
28562845
[Fact]
28572846
public async Task UpdateSecretScanningAlert_Calls_The_Right_Endpoint_With_Payload_For_Resolved_State()
28582847
{

src/OctoshiftCLI.Tests/ado2gh/Commands/GenerateScript/GenerateScriptCommandHandlerTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ public class GenerateScriptCommandHandlerTests
2828
private const string GITHUB_ORG = "GITHUB_ORG";
2929
private const string ADO_SERVER_URL = "http://ado.contoso.com";
3030

31-
private readonly IEnumerable<string> ADO_ORGS = new List<string>() { ADO_ORG };
32-
private readonly IEnumerable<string> ADO_TEAM_PROJECTS = new List<string>() { ADO_TEAM_PROJECT };
33-
private IEnumerable<AdoRepository> ADO_REPOS = new List<AdoRepository> { new() { Name = FOO_REPO } };
34-
private IEnumerable<string> ADO_PIPELINES = new List<string>() { FOO_PIPELINE };
35-
private readonly IEnumerable<string> EMPTY_PIPELINES = new List<string>();
31+
private readonly IEnumerable<string> ADO_ORGS = [ADO_ORG];
32+
private readonly IEnumerable<string> ADO_TEAM_PROJECTS = [ADO_TEAM_PROJECT];
33+
private IEnumerable<AdoRepository> ADO_REPOS = [new() { Name = FOO_REPO }];
34+
private IEnumerable<string> ADO_PIPELINES = [FOO_PIPELINE];
35+
private readonly IEnumerable<string> EMPTY_PIPELINES = [];
3636

3737
private readonly Mock<AdoApi> _mockAdoApi = TestHelpers.CreateMock<AdoApi>();
3838
private readonly Mock<AdoInspectorService> _mockAdoInspector = TestHelpers.CreateMock<AdoInspectorService>();
@@ -326,7 +326,7 @@ public async Task SequentialScript_Skips_Team_Project_With_No_Repos()
326326
public async Task SequentialScript_Single_Repo_Two_Pipelines_All_Options()
327327
{
328328
// Arrange
329-
ADO_PIPELINES = new List<string> { FOO_PIPELINE, BAR_PIPELINE };
329+
ADO_PIPELINES = [FOO_PIPELINE, BAR_PIPELINE];
330330

331331
_mockAdoApi.Setup(m => m.GetTeamProjects(ADO_ORG)).ReturnsAsync(ADO_TEAM_PROJECTS);
332332
_mockAdoApi.Setup(m => m.GetGithubAppId(ADO_ORG, GITHUB_ORG, ADO_TEAM_PROJECTS)).ReturnsAsync(APP_ID);
@@ -374,7 +374,7 @@ public async Task SequentialScript_Single_Repo_Two_Pipelines_All_Options()
374374
public async Task SequentialScript_Single_Repo_Two_Pipelines_No_Service_Connection_All_Options()
375375
{
376376
// Arrange
377-
ADO_PIPELINES = new List<string> { FOO_PIPELINE, BAR_PIPELINE };
377+
ADO_PIPELINES = [FOO_PIPELINE, BAR_PIPELINE];
378378

379379
_mockAdoInspector.Setup(m => m.GetRepoCount()).ReturnsAsync(1);
380380
_mockAdoInspector.Setup(m => m.GetOrgs()).ReturnsAsync(ADO_ORGS);
@@ -874,7 +874,7 @@ public async Task ParallelScript_Skips_Team_Project_With_No_Repos()
874874
public async Task ParallelScript_Two_Repos_Two_Pipelines_All_Options()
875875
{
876876
// Arrange
877-
ADO_REPOS = new List<AdoRepository> { new() { Name = FOO_REPO }, new() { Name = BAR_REPO } };
877+
ADO_REPOS = [new() { Name = FOO_REPO }, new() { Name = BAR_REPO }];
878878

879879
_mockAdoApi.Setup(m => m.GetTeamProjects(ADO_ORG)).ReturnsAsync(ADO_TEAM_PROJECTS);
880880
_mockAdoApi.Setup(m => m.GetGithubAppId(ADO_ORG, GITHUB_ORG, ADO_TEAM_PROJECTS)).ReturnsAsync(APP_ID);
@@ -1031,7 +1031,7 @@ exit 1
10311031
public async Task ParallelScript_Single_Repo_No_Service_Connection_All_Options()
10321032
{
10331033
// Arrange
1034-
ADO_PIPELINES = new List<string> { FOO_PIPELINE, BAR_PIPELINE };
1034+
ADO_PIPELINES = [FOO_PIPELINE, BAR_PIPELINE];
10351035

10361036
_mockAdoApi.Setup(m => m.GetTeamProjects(ADO_ORG)).ReturnsAsync(ADO_TEAM_PROJECTS);
10371037

src/OctoshiftCLI.Tests/ado2gh/Commands/MigrateRepo/MigrateRepoCommandHandlerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ await _handler.Invoking(async x => await x.Handle(new MigrateRepoCommandArgs
251251
[Fact]
252252
public async Task It_Falls_Back_To_Ado_And_Github_Pats_From_Environment_When_Not_Provided()
253253
{
254-
_mockGithubApi.Setup(x => x.GetRepos(GITHUB_ORG).Result).Returns(new List<(string Name, string Visibility)>());
254+
_mockGithubApi.Setup(x => x.GetRepos(GITHUB_ORG).Result).Returns([]);
255255
_mockGithubApi.Setup(x => x.GetMigration(It.IsAny<string>()).Result).Returns((State: RepositoryMigrationStatus.Succeeded, GITHUB_REPO, 0, null, null));
256256

257257
_mockEnvironmentVariableProvider

src/OctoshiftCLI.Tests/ado2gh/Services/OrgsCsvGeneratorServiceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class OrgsCsvGeneratorServiceTests
2121
private readonly Mock<AdoInspectorServiceFactory> _mockAdoInspectorServiceFactory = TestHelpers.CreateMock<AdoInspectorServiceFactory>();
2222

2323
private const string ADO_ORG = "foo-org";
24-
private readonly IEnumerable<string> _adoOrgs = new List<string>() { ADO_ORG };
24+
private readonly IEnumerable<string> _adoOrgs = [ADO_ORG];
2525

2626
private readonly OrgsCsvGeneratorService _service;
2727

src/OctoshiftCLI.Tests/ado2gh/Services/PipelinesCsvGeneratorServiceTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ public class PipelinesCsvGeneratorServiceTests
2020
private readonly Mock<AdoInspectorServiceFactory> _mockAdoInspectorServiceFactory = TestHelpers.CreateMock<AdoInspectorServiceFactory>();
2121

2222
private const string ADO_ORG = "foo-org";
23-
private readonly IEnumerable<string> _adoOrgs = new List<string>() { ADO_ORG };
23+
private readonly IEnumerable<string> _adoOrgs = [ADO_ORG];
2424
private const string ADO_TEAM_PROJECT = "foo-tp";
25-
private readonly IEnumerable<string> _adoTeamProjects = new List<string>() { ADO_TEAM_PROJECT };
25+
private readonly IEnumerable<string> _adoTeamProjects = [ADO_TEAM_PROJECT];
2626
private const string ADO_REPO = "foo-repo";
27-
private readonly IEnumerable<AdoRepository> _adoRepos = new List<AdoRepository> { new() { Name = ADO_REPO } };
27+
private readonly IEnumerable<AdoRepository> _adoRepos = [new() { Name = ADO_REPO }];
2828
private const string ADO_PIPELINE = "foo-pipeline";
29-
private readonly IEnumerable<string> _adoPipelines = new List<string>() { ADO_PIPELINE };
29+
private readonly IEnumerable<string> _adoPipelines = [ADO_PIPELINE];
3030

3131
private readonly PipelinesCsvGeneratorService _service;
3232

src/OctoshiftCLI.Tests/ado2gh/Services/ReposCsvGeneratorServiceTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ public class ReposCsvGeneratorServiceTests
2222
private readonly Mock<AdoInspectorServiceFactory> _mockAdoInspectorServiceFactory = TestHelpers.CreateMock<AdoInspectorServiceFactory>();
2323

2424
private const string ADO_ORG = "foo-org";
25-
private readonly IEnumerable<string> _adoOrgs = new List<string>() { ADO_ORG };
25+
private readonly IEnumerable<string> _adoOrgs = [ADO_ORG];
2626
private const string ADO_TEAM_PROJECT = "foo-tp";
27-
private readonly IEnumerable<string> _adoTeamProjects = new List<string>() { ADO_TEAM_PROJECT };
27+
private readonly IEnumerable<string> _adoTeamProjects = [ADO_TEAM_PROJECT];
2828
private const string ADO_REPO = "foo-repo";
29-
private readonly IEnumerable<AdoRepository> _adoRepos = new List<AdoRepository> { new() { Name = ADO_REPO, Size = 12345 } };
29+
private readonly IEnumerable<AdoRepository> _adoRepos = [new() { Name = ADO_REPO, Size = 12345 }];
3030

3131
private readonly ReposCsvGeneratorService _service;
3232

src/OctoshiftCLI.Tests/ado2gh/Services/TeamProjectsCsvGeneratorServiceTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ public class TeamProjectsCsvGeneratorServiceTests
2121
private readonly Mock<AdoInspectorServiceFactory> _mockAdoInspectorServiceFactory = TestHelpers.CreateMock<AdoInspectorServiceFactory>();
2222

2323
private const string ADO_ORG = "foo-org";
24-
private readonly IEnumerable<string> _adoOrgs = new List<string>() { ADO_ORG };
24+
private readonly IEnumerable<string> _adoOrgs = [ADO_ORG];
2525
private const string ADO_TEAM_PROJECT = "foo-tp";
26-
private readonly IEnumerable<string> _adoTeamProjects = new List<string>() { ADO_TEAM_PROJECT };
26+
private readonly IEnumerable<string> _adoTeamProjects = [ADO_TEAM_PROJECT];
2727

2828
private readonly TeamProjectsCsvGeneratorService _service;
2929

0 commit comments

Comments
 (0)