Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
312ca49
refactor(ParseArgs): simplify __call__ function body
bearomorphism Jun 12, 2025
56ef1e0
refactor(ExpectedExit): make the constructor more compact
bearomorphism Jun 12, 2025
8cf7acd
refactor(ScmProvider): replace sorted with max
bearomorphism Jun 12, 2025
fb04e28
refactor(git): remove redundant if branch
bearomorphism Jun 12, 2025
1a1fdc6
fix(Bump): rewrite --get-next NotAllowed error message for consistency
bearomorphism Jun 13, 2025
93f0f27
fix(Changelog): fix _export_template variable type
bearomorphism Jun 13, 2025
7a531db
refactor(TagRules): extract tag_formats property and simplify list co…
bearomorphism Jun 13, 2025
9163ae2
refactor(Init): use ternary operator
bearomorphism Jun 10, 2025
6a90185
refactor(bump): use a loop to shorten a series of similar NotAllowed …
bearomorphism Jun 9, 2025
c169e09
fix: raise NoVersionSpecifiedError if version is None, and adjust cal…
bearomorphism Jun 13, 2025
0fa668d
docs(taplo): add toml formatter
bearomorphism May 25, 2025
d9f5b49
docs(pre-commit): add taplo to pre-commit hook
bearomorphism May 25, 2025
aa9ab24
refactor(Changelog): remove unnecessary intermediate variables for be…
bearomorphism Jun 13, 2025
3d635d2
refactor(changelog): shorten condition expression and early return
bearomorphism Jun 12, 2025
68c4360
refactor(Init): extract _get_config_data for readability
bearomorphism Jun 11, 2025
05c1722
refactor(process_commit_message): better type and early return
bearomorphism Jun 12, 2025
4a1c516
build: remove not needed importlib-metadata dependency for python >= …
bearomorphism Jun 10, 2025
84706e1
docs(defaults): deprecate type Questions
bearomorphism Jun 10, 2025
936352b
docs(customization.md): fix grammar mistake, add title to code blocks
bearomorphism Jun 10, 2025
7dccbf6
docs(bump.md): add titles to code blocks and fix minor grammar issues
bearomorphism Jun 11, 2025
189cf0b
ci(github-actions): set organization to true for JamesIves/github-spo…
Lee-W Jun 13, 2025
1d92a05
ci(deps): bump dawidd6/action-homebrew-bump-formula from 4 to 5
dependabot[bot] Jun 16, 2025
fe48353
docs(config.md): Document glob pattern support in `version_files`
edgarrmondragon Jul 12, 2025
eca443d
docs(third-party-commitizen.md): Add cz-path info
Tatsh Jul 14, 2025
83d9308
ci(github-actions): fix sponsorship page generation
Lee-W Jul 15, 2025
40d3062
docs(README): install into dev dependency when using uv
timsu92 Aug 6, 2025
89600f0
docs(README): ensure line break
timsu92 Aug 6, 2025
a69d441
refactor(init): remote extra words
timsu92 Aug 6, 2025
b8918a1
refactor(Init): fix unbounded variable in _ask_tag_format
bearomorphism Jun 10, 2025
30baeab
test(Init): improve coverage for _ask_tag_format
bearomorphism Jun 10, 2025
e70c0a6
fix(ExitCode): add from_str in ExitCode and replace parse_no_raise wi…
bearomorphism Jun 12, 2025
d417cf7
fix(Init): fix a typo in _ask_version_provider options and remove unn…
bearomorphism Jun 10, 2025
1118f65
fix(init): make welcome message easier to read
bearomorphism Jun 9, 2025
e28e3ce
refactor(Init): remove unnecessary methods from ProjectInfo and refac…
bearomorphism Jun 10, 2025
a498804
test(Init): cover _ask_tag test
bearomorphism Jun 10, 2025
d9058b6
fix(init): use pre-push as pre-commit stage
timsu92 Aug 6, 2025
445f013
test(init): check "pre-" is showing in outputs
timsu92 Aug 6, 2025
0b374af
refactor(Init): remove the variable values_to_add and the update_conf…
bearomorphism Jun 11, 2025
f8be15a
test(Init): improve test coverage on config initialization
bearomorphism Jun 11, 2025
f30ae2e
refactor(changelog): shorten generate_tree_from_commits
bearomorphism Jun 12, 2025
7cd62fb
feat(check): add check against default branch
bearomorphism Jun 3, 2025
3b00235
test(changelog): ensure error on missing changelog template filename
ongdisheng Jul 6, 2025
69db5b4
fix(dependencies): update tomlkit version to >=0.8.0,<1.0.0
Narwhal-fish Aug 19, 2025
046e749
feat(bump_rule): add BumpRule, VersionIncrement, Prerelease Enum
bearomorphism May 17, 2025
bec90cd
docs(bump.md): add documentation about the bump rule change
bearomorphism Jun 10, 2025
2c51510
refactor(bump_rule): rename function
bearomorphism Aug 24, 2025
d2413c1
refactor(bump_rule): resolve comments
bearomorphism Aug 24, 2025
9cacfcb
docs(BumpRule): adjust docstring
bearomorphism Aug 24, 2025
6685282
refactor(bump): nit
bearomorphism Aug 24, 2025
b57628a
refactor(bump_rule): get rid of a simple function
bearomorphism Aug 24, 2025
3cf6689
refactor(bump_rule): nit
bearomorphism Aug 24, 2025
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
23 changes: 11 additions & 12 deletions .github/workflows/docspublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
workflow_dispatch:

jobs:
update-cli-screenshots:
Expand Down Expand Up @@ -58,21 +59,19 @@ jobs:
python -m pip install -U pip poetry poethepoet
poetry --version
poetry install --no-root --only documentation
- name: Build docs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
poetry doc:build
- name: Generate Sponsors 💖
uses: JamesIves/github-sponsors-readme-action@v1
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN_FOR_ORG }}
file: "docs/README.md"
- name: Push doc to Github Page
uses: peaceiris/actions-gh-pages@v4
organization: true
- name: Build docs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
poetry doc:build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
personal_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
publish_branch: gh-pages
publish_dir: ./site
user_name: "github-actions[bot]"
user_email: "github-actions[bot]@users.noreply.github.com"
folder: ./site # The folder the action should deploy.
branch: gh-pages
2 changes: 1 addition & 1 deletion .github/workflows/homebrewpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: |
echo "project_version=$(cz version --project)" >> $GITHUB_ENV
- name: Update Homebrew formula
uses: dawidd6/action-homebrew-bump-formula@v4
uses: dawidd6/action-homebrew-bump-formula@v5
with:
token: ${{secrets.PERSONAL_ACCESS_TOKEN}}
formula: commitizen
Expand Down
11 changes: 8 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
- id: debug-statements
- id: no-commit-to-branch
- id: check-merge-conflict
- id: check-toml
- id: check-toml # TOML linter (syntax checker)
- id: check-yaml
args: [ '--unsafe' ] # for mkdocs.yml
- id: detect-private-key
Expand Down Expand Up @@ -55,17 +55,22 @@ repos:
stages:
- post-commit

- repo: https://github.com/ComPWA/taplo-pre-commit
rev: v0.9.3
hooks:
- id: taplo-format

- repo: local
hooks:
- id: format
name: Format
name: Format Python code via Poetry
language: system
pass_filenames: false
entry: poetry format
types: [ python ]

- id: linter and test
name: Linters
name: Linters via Poetry
language: system
pass_filenames: false
entry: poetry lint
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
pass_filenames: false
language: python
language_version: python3
minimum_pre_commit_version: "1.4.3"
minimum_pre_commit_version: "3.2.0"
4 changes: 4 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include = ["pyproject.toml", ".taplo.toml"]

[formatting]
indent_string = " "
53 changes: 3 additions & 50 deletions commitizen/bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,14 @@

import os
import re
from collections import OrderedDict
from collections.abc import Iterable
from glob import iglob
from logging import getLogger
from string import Template
from typing import cast

from commitizen.defaults import BUMP_MESSAGE, ENCODING, MAJOR, MINOR, PATCH
from commitizen.defaults import BUMP_MESSAGE, ENCODING
from commitizen.exceptions import CurrentVersionNotFoundError
from commitizen.git import GitCommit, smart_open
from commitizen.version_schemes import Increment, Version

VERSION_TYPES = [None, PATCH, MINOR, MAJOR]

logger = getLogger("commitizen")


def find_increment(
commits: list[GitCommit], regex: str, increments_map: dict | OrderedDict
) -> Increment | None:
if isinstance(increments_map, dict):
increments_map = OrderedDict(increments_map)

# Most important cases are major and minor.
# Everything else will be considered patch.
select_pattern = re.compile(regex)
increment: str | None = None

for commit in commits:
for message in commit.message.split("\n"):
result = select_pattern.search(message)

if result:
found_keyword = result.group(1)
new_increment = None
for match_pattern in increments_map.keys():
if re.match(match_pattern, found_keyword):
new_increment = increments_map[match_pattern]
break

if new_increment is None:
logger.debug(
f"no increment needed for '{found_keyword}' in '{message}'"
)

if VERSION_TYPES.index(increment) < VERSION_TYPES.index(new_increment):
logger.debug(
f"increment detected is '{new_increment}' due to '{found_keyword}' in '{message}'"
)
increment = new_increment

if increment == MAJOR:
break

return cast(Increment, increment)
from commitizen.git import smart_open
from commitizen.version_schemes import Version


def update_version_in_files(
Expand Down
Loading
Loading