Skip to content

Commit 3bc31de

Browse files
CopilotAArnott
andcommitted
Address code review feedback
- Use StringComparison.Ordinal for string comparison - Add clarifying comment for manual JSON creation in test Co-authored-by: AArnott <[email protected]>
1 parent 2c8cae0 commit 3bc31de

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/NerdBank.GitVersioning/VersionFile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ protected static void ApplyPrereleaseProperty(VersionOptions options)
245245

246246
// Apply the prerelease tag to the version
247247
string prereleaseTag = options.Prerelease;
248-
if (!prereleaseTag.StartsWith("-"))
248+
if (!prereleaseTag.StartsWith("-", StringComparison.Ordinal))
249249
{
250250
// Add the hyphen prefix if not present
251251
prereleaseTag = "-" + prereleaseTag;

test/Nerdbank.GitVersioning.Tests/VersionFileTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,9 @@ public void Prerelease_ThrowsWhen_VersionAlreadyHasPrerelease()
811811
this.WriteVersionFile(parent);
812812

813813
// Create a child version.json that specifies both version with prerelease AND prerelease property
814-
// This creates an invalid state that should throw when read
814+
// This creates an invalid state that should throw when read.
815+
// Note: We manually create the JSON here (rather than using WriteVersionFile) because
816+
// this is an intentionally invalid configuration that cannot be represented through the API.
815817
string childPath = Path.Combine(this.RepoPath, "child");
816818
Directory.CreateDirectory(childPath);
817819
string versionJsonPath = Path.Combine(childPath, "version.json");

0 commit comments

Comments
 (0)