Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle non-standard capitalizations of Unreleased #25

Merged
merged 3 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Fixed

- Properly handle non-standard capitalizations of `Unreleased`

## [1.0.2] - 2024-10-18

### Changed
Expand Down
11 changes: 11 additions & 0 deletions bumpchanges/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,17 @@ def from_tokens(cls, tokens):
)
kwargs["version_str"] = kwargs["version_str"][1:]

# Correctly case `Unreleased`
if (
kwargs["version_str"] != cls.UNRELEASED_VERSION
and kwargs["version_str"].lower() == cls.UNRELEASED_VERSION.lower()
):
logging.getLogger(__name__).warning(
"Case-correcting Changelog version `%s`",
kwargs["version_str"],
)
kwargs["version_str"] = cls.UNRELEASED_VERSION

# The rest of the tokens should be the lists. Strip any rulers now.
tokens = [token for token in tokens[3:] if token.type != "hr"]

Expand Down
2 changes: 1 addition & 1 deletion tests/resources/original.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

---

## Unreleased
## unreleased

### Added

Expand Down