commitizen-tools / commitizen

Create committing rules for projects :rocket: auto bump versions :arrow_up: and auto changelog generation :open_file_folder:
https://commitizen-tools.github.io/commitizen/
MIT License
2.55k stars 266 forks source link

feat(tags): adds `legacy_tag_formats` and `ignored_tag_formats` settings #1297

Open noirbizarre opened 3 hours ago

noirbizarre commented 3 hours ago

Description

This PR add 2 new settings to handle tag formats;

So projects which change tag formats and have expected but non-version tags can have these settings:

tag_format = "v${version}"
legacy_tag_formats = [
    "${version}",
    "project-prefix-${version}",
]
ignored_tag_formats = [
    "stable",
    "other-project-*",
]

By doing so, I had to start grouping tag handling and introduce a tags.TagRules object which is responsible for handling all tags rules, initially spread over tag_format, version_schemes and version_providers

Checklist

Expected behavior

Steps to Test This Pull Request

then:

Additional context

There might be a 2nd PR handling a changelog_version_format setting to customize the version rendering in the changelog so:

codecov[bot] commented 3 hours ago

Codecov Report

Attention: Patch coverage is 99.43182% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.65%. Comparing base (120d514) to head (6eeeb41). Report is 496 commits behind head on master.

Files with missing lines Patch % Lines
commitizen/commands/bump.py 92.85% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1297 +/- ## ========================================== + Coverage 97.33% 97.65% +0.32% ========================================== Files 42 56 +14 Lines 2104 2606 +502 ========================================== + Hits 2048 2545 +497 - Misses 56 61 +5 ``` | [Flag](https://app.codecov.io/gh/commitizen-tools/commitizen/pull/1297/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/commitizen-tools/commitizen/pull/1297/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | `97.65% <99.43%> (+0.32%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.