Skip to content

Add VersionExtensions.ToSemanticString()#42

Merged
Tyrrrz merged 6 commits intoprimefrom
copilot/add-version-extensions
Apr 17, 2026
Merged

Add VersionExtensions.ToSemanticString()#42
Tyrrrz merged 6 commits intoprimefrom
copilot/add-version-extensions

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 17, 2026

Ports VersionExtensions from CliFx — a ToSemanticString() extension on System.Version that omits the revision component when it is unset.

Changes

  • VersionExtensions.cs — new extension; returns version.ToString(3) when Revision <= 0, otherwise version.ToString()
  • VersionExtensionsTests.cs — covers no-revision, zero-revision, and non-zero-revision cases
new Version(1, 2, 3).ToSemanticString()    // "1.2.3"
new Version(1, 2, 3, 0).ToSemanticString() // "1.2.3"
new Version(1, 2, 3, 4).ToSemanticString() // "1.2.3.4"

@Tyrrrz Tyrrrz added the enhancement New feature or request label Apr 17, 2026
@Tyrrrz Tyrrrz marked this pull request as ready for review April 17, 2026 07:05
Copilot AI review requested due to automatic review settings April 17, 2026 07:05
Comment thread PowerKit.Tests/VersionExtensionsTests.cs
Copilot AI requested a review from Tyrrrz April 17, 2026 07:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a System.Version extension for formatting “semantic” version strings by omitting the revision component when appropriate, along with accompanying unit tests.

Changes:

  • Introduces VersionExtensions.ToSemanticString() for System.Version.
  • Adds unit tests covering revision omitted/kept behavior (including zero revision).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
PowerKit/Extensions/VersionExtensions.cs Adds ToSemanticString() extension implementation for Version.
PowerKit.Tests/VersionExtensionsTests.cs Adds xUnit/FluentAssertions coverage for the new extension method.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread PowerKit/Extensions/VersionExtensions.cs Outdated
Comment thread PowerKit.Tests/VersionExtensionsTests.cs
Comment thread PowerKit/Extensions/VersionExtensions.cs Outdated
Tyrrrz and others added 3 commits April 17, 2026 11:02
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.63%. Comparing base (667c235) to head (bd0957f).
⚠️ Report is 6 commits behind head on prime.

Additional details and impacted files
@@            Coverage Diff             @@
##            prime      #42      +/-   ##
==========================================
+ Coverage   94.47%   94.63%   +0.16%     
==========================================
  Files          76       82       +6     
  Lines        1574     1623      +49     
  Branches      131      135       +4     
==========================================
+ Hits         1487     1536      +49     
  Misses         65       65              
  Partials       22       22              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Tyrrrz
Copy link
Copy Markdown
Owner

Tyrrrz commented Apr 17, 2026

@copilot please fix formatting

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 17, 2026

@copilot please fix formatting

Fixed in bd0957f — reformatted the chained ternary to match CSharpier's expected style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants