Skip to content

134 potential bug in beta format - #137

Merged
devsetgo merged 6 commits into
mainfrom
134-potential-bug-in-beta-format
May 24, 2026
Merged

134 potential bug in beta format#137
devsetgo merged 6 commits into
mainfrom
134-potential-bug-in-beta-format

Conversation

@devsetgo

@devsetgo devsetgo commented May 24, 2026

Copy link
Copy Markdown
Owner

Description

This pull request introduces a feature to configure the suffix format for pre-release versions in the bumpcalver tool. Three new optional configuration parameters have been added to the bumpcalver.toml file: beta_format, rc_format, and release_format. These parameters allow users to specify the suffix appended when using --beta, --rc, and --release options respectively.

For example, users can now define custom suffix formats like {beta_count} for auto-incrementing beta versions, rc{rc_count} for release candidate versions, and a literal .release suffix for final release versions. These configurations provide flexibility in defining version suffixes based on specific project requirements.

Additionally, the pull request includes updates to the documentation in the README.md file to explain how to configure and use the new suffix formats. Examples are provided to demonstrate the usage of the new configuration options and how they affect the generated versions.

Overall, this enhancement improves the customization options for pre-release versioning in the bumpcalver tool, making it more versatile and adaptable to different project workflows.

devsetgo and others added 2 commits May 24, 2026 00:43
…ored

Three bugs in the pre-release suffix path:
1. beta_format / rc_format / release_format were never read from config;
   the suffixes were hardcoded as ".beta", ".rc", ".release" in cli.py.
2. _clean_version_suffixes only stripped dot-prefixed forms (.beta),
   so PEP 440-style attached suffixes (b1, rc2, a1) were left on the
   version string, causing build-count parsing to fail and reset to 1.
3. No support for count placeholders like {beta_count} in the format.

Fix:
- config.py: load beta_format / rc_format / release_format (defaults
  preserve the existing ".beta" / ".rc" / ".release" behaviour).
- utils.py: extend _clean_version_suffixes to also strip PEP 440-style
  suffixes (b1, a1, rc1 etc.); add apply_prerelease_suffix() which
  honours {xxx_count} placeholders and auto-increments the counter by
  inspecting the current stored version.
- cli.py: replace hardcoded string appends with apply_prerelease_suffix(),
  reading the configured format and the current raw version for counting.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@devsetgo devsetgo linked an issue May 24, 2026 that may be closed by this pull request
devsetgo and others added 4 commits May 24, 2026 00:51
- README: document beta_format / rc_format / release_format config keys
  and add a Pre-release Versioning examples section
- docs/quickstart.md: correct wrong description ("prefix with beta-");
  point to configuration reference
- docs/calendar-versioning-guide.md: replace the Beta/Alpha section with
  accurate Pre-release Suffixes section covering both dot-prefixed and
  PEP 440 counter forms
- docs/examples/configuration.md: add Pre-release Suffix Formats section
  with a quick-reference table and counter-behaviour notes; add commented
  keys to both pyproject.toml and bumpcalver.toml example blocks
- examples/pyproject.toml, examples/bumpcalver.toml: add commented
  pre-release format hints alongside the existing hybrid versioning hints

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
[a-zA-Z]+\d*$ triggers Sonar's polynomial-runtime warning because the
broad character class combined with a +\d* quantifier pair can be flagged
as potentially catastrophic even though the classes are disjoint.

Replace with an explicit alternation of the known PEP 440 pre-release
identifiers (alpha|beta|rc|a|b) so the engine has no ambiguity to
explore and backtracking is eliminated.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@devsetgo
devsetgo merged commit d122a3b into main May 24, 2026
14 checks passed
@devsetgo
devsetgo deleted the 134-potential-bug-in-beta-format branch May 24, 2026 01:41
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.

Potential Bug in beta format

1 participant