Skip to content

Conversation

@billf
Copy link
Contributor

@billf billf commented May 22, 2025

Expose semver module and improve its documentation

This PR makes the semver module public and adds comprehensive documentation to improve its usability. The changes include:

  • Added module-level documentation explaining the purpose of VersionMap
  • Added detailed documentation for the VersionMap struct and all its methods
  • Added explanations of the alternate version lookup logic
  • Included a usage example in the documentation
  • Added documentation for internal fields and helper functions
  • Improved code readability with more descriptive comments

These changes make the semantic versioning functionality available to consumers of the library and provide clear guidance on how to use it effectively.

Copy link
Contributor Author

billf commented May 22, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

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

This PR makes the semver module public and enriches its VersionMap API with comprehensive documentation.

  • Exposes semver in the crate’s public API.
  • Adds module- and item-level docs, including usage examples and alternate lookup logic.
  • Documents all VersionMap methods and internal helpers.

Reviewed Changes

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

File Description
src/semver.rs Added public docs for VersionMap, its methods, and version_alternate.
src/lib.rs Changed mod semver; to pub mod semver; to expose the module.
Comments suppressed due to low confidence (1)

src/semver.rs:19

  • Add unit tests for the alternate lookup logic covering: pre-release versions (should return None), major-version fallback, minor-version fallback when major is 0, and patch-level fallback. Also test get_or_latest behavior when None is provided or when the map is empty.
- For minor versions > 0 (when major is 0): alternate is `0.minor.0`

@billf billf changed the base branch from billf/format to graphite-base/2 May 23, 2025 22:08
@billf billf force-pushed the billf/semver/base branch from 03f3e94 to 05a8696 Compare May 23, 2025 22:08
@billf billf force-pushed the graphite-base/2 branch from d8e8a6a to 48abe88 Compare May 23, 2025 22:08
@billf billf changed the base branch from graphite-base/2 to master May 23, 2025 22:08
@billf billf force-pushed the billf/semver/base branch from 05a8696 to fe2b1f3 Compare May 26, 2025 23:27
@billf billf marked this pull request as ready for review May 27, 2025 00:25
@graphite-app graphite-app bot requested a review from a team May 27, 2025 00:25
@billf billf requested a review from Copilot May 27, 2025 00:25
@graphite-app
Copy link

graphite-app bot commented May 27, 2025

Graphite Automations

"Request reviewers once CI passes" took an action on this PR • (05/27/25)

1 assignee was added and 1 reviewer was added to this PR based on bill fumerola's automation.

Copy link

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

This PR exposes the semver module publicly and enhances its documentation to improve clarity and usability.

  • Made the semver module public in lib.rs
  • Added comprehensive module- and method-level documentation in src/semver.rs
  • Included detailed usage examples and alternate lookup logic documentation

Reviewed Changes

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

File Description
src/semver.rs Added documentation, new methods, and alternate lookup logic for VersionMap.
src/lib.rs Updated semver module from private to public.
Comments suppressed due to low confidence (1)

src/semver.rs:109

  • The alternate lookup condition in get() checks version.build.is_empty(), but according to the alternate logic and the version_alternate() implementation, it should check if version.pre is empty to correctly bypass alternate lookups for pre-release versions.
if version.build.is_empty() {

@billf billf merged commit 5511b88 into master May 28, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants