Skip to content

Commit db1f675

Browse files
committed
cleanup - use collection expressions
1 parent 628b8ef commit db1f675

28 files changed

+41
-42
lines changed

src/GitVersion.App.Tests/PullRequestInBuildAgentTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ private static async Task VerifyPullRequestVersionIsCalculatedProperly(string pu
163163
remoteRepository.Refs.Add(pullRequestRef, new ObjectId(mergeCommitSha));
164164

165165
// Checkout PR commit
166-
Commands.Fetch(fixture.Repository, "origin", Array.Empty<string>(), new FetchOptions(), null);
166+
Commands.Fetch(fixture.Repository, "origin", [], new FetchOptions(), null);
167167
Commands.Checkout(fixture.Repository, mergeCommitSha);
168168
}
169169

src/GitVersion.App.Tests/TagCheckoutInBuildAgentTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ private static async Task VerifyTagCheckoutVersionIsCalculatedProperly(Dictionar
5252
remoteRepository.MergeNoFF("release/0.2.0", Generate.SignatureNow());
5353
remoteRepository.MakeATaggedCommit("0.2.0");
5454

55-
Commands.Fetch(fixture.Repository, "origin", Array.Empty<string>(), new FetchOptions(), null);
55+
Commands.Fetch(fixture.Repository, "origin", [], new FetchOptions(), null);
5656
Commands.Checkout(fixture.Repository, "0.2.0");
5757
}
5858

src/GitVersion.App/QuotedStringHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ internal static class QuotedStringHelpers
2323
public static string[] SplitUnquoted(string? input, char splitChar)
2424
{
2525
if (input == null)
26-
return Array.Empty<string>();
26+
return [];
2727

2828
var split = new List<string>();
2929
bool isPreviousCharBackslash = false;

src/GitVersion.BuildAgents.Tests/Agents/BuildServerBaseTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,6 @@ public BuildAgent(IEnvironment environment, ILog log) : base(environment, log)
6161

6262
public override string GenerateSetVersionMessage(GitVersionVariables variables) => variables.FullSemVer;
6363

64-
public override string[] GenerateSetParameterMessage(string name, string? value) => Array.Empty<string>();
64+
public override string[] GenerateSetParameterMessage(string name, string? value) => [];
6565
}
6666
}

src/GitVersion.BuildAgents/Agents/BuildKite.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public override string GenerateSetVersionMessage(GitVersionVariables variables)
1919
string.Empty; // There is no equivalent function in BuildKite.
2020

2121
public override string[] GenerateSetParameterMessage(string name, string? value) =>
22-
Array.Empty<string>(); // There is no equivalent function in BuildKite.
22+
[]; // There is no equivalent function in BuildKite.
2323

2424
public override string? GetCurrentBranch(bool usingDynamicRepos)
2525
{

src/GitVersion.BuildAgents/Agents/GitHubActions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public override string GenerateSetVersionMessage(GitVersionVariables variables)
2121
string.Empty; // There is no equivalent function in GitHub Actions.
2222

2323
public override string[] GenerateSetParameterMessage(string name, string? value) =>
24-
Array.Empty<string>(); // There is no equivalent function in GitHub Actions.
24+
[]; // There is no equivalent function in GitHub Actions.
2525

2626
public override void WriteIntegration(Action<string?> writer, GitVersionVariables variables, bool updateBuildNumber = true)
2727
{

src/GitVersion.BuildAgents/Agents/SpaceAutomation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public SpaceAutomation(IEnvironment environment, ILog log) : base(environment, l
1515

1616
public override string? GetCurrentBranch(bool usingDynamicRepos) => Environment.GetEnvironmentVariable("JB_SPACE_GIT_BRANCH");
1717

18-
public override string[] GenerateSetParameterMessage(string name, string? value) => Array.Empty<string>();
18+
public override string[] GenerateSetParameterMessage(string name, string? value) => [];
1919

2020
public override string GenerateSetVersionMessage(GitVersionVariables variables) => string.Empty;
2121
}

src/GitVersion.Core.Tests/Core/RepositoryStoreTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public void FindCommitBranchWasBranchedFromShouldReturnNullIfTheRemoteIsTheOnlyS
227227
branch.ShouldNotBeNull();
228228

229229
var configuration = GitFlowConfigurationBuilder.New.Build();
230-
var branchedCommit = gitRepoMetadataProvider.FindCommitBranchWasBranchedFrom(branch, configuration, Array.Empty<IBranch>());
230+
var branchedCommit = gitRepoMetadataProvider.FindCommitBranchWasBranchedFrom(branch, configuration, []);
231231
branchedCommit.ShouldBe(BranchCommit.Empty);
232232

233233
var branchedCommits = gitRepoMetadataProvider.FindCommitBranchesWasBranchedFrom(branch, configuration).ToArray();

src/GitVersion.Core.Tests/Extensions/GitToolsTestingExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static ICommit CreateMockCommit()
2525
commit.Id.Returns(objectId);
2626
commit.Sha.Returns(sha);
2727
commit.Message.Returns("Commit " + commitCount++);
28-
commit.Parents.Returns(Enumerable.Empty<ICommit>());
28+
commit.Parents.Returns([]);
2929
commit.When.Returns(when.AddSeconds(1));
3030
return commit;
3131
}

src/GitVersion.Core.Tests/Helpers/TestEffectiveConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public TestEffectiveConfiguration(
5050
patchMessage,
5151
noBumpMessage,
5252
commitMessageMode,
53-
versionFilters ?? Enumerable.Empty<IVersionFilter>(),
53+
versionFilters ?? [],
5454
tracksReleaseBranches,
5555
isRelease,
5656
isMainline,

0 commit comments

Comments
 (0)