commitizen icon indicating copy to clipboard operation
commitizen copied to clipboard

change log was generated with garbage data

Open YoniRomm opened this issue 2 years ago • 4 comments

Description

I extended the ConventionalCommitsCz class with my own class that it's whole purpose was to bump patch version for commit with prefix test(bump): <some title>.

my file cz_bumpForTest.py

from commitizen.cz.conventional_commits import ConventionalCommitsCz
from commitizen import defaults

class BumpfortestCz(ConventionalCommitsCz):
    # bump_pattern is the same as defaults.bump_pattern with addition of the test prefix
    bump_pattern = r"^(((BREAKING[\-\ ]CHANGE|feat|fix|refactor|perf|test)(\(.+\))?(!)?)|\w+!):"
    bump_map = ConventionalCommitsCz.bump_map
    bump_map[r"^test\(bump\)"] = defaults.PATCH

and setup.py

from setuptools import setup

setup(
    name="bumpForTest",
    version="0.1.0",
    py_modules=["cz_bumpForTest"],
    license="Not open source",
    long_description="bumps also for test prefix if it of the format test(bump): add new test",
    install_requires=["commitizen"],
    entry_points={"commitizen.plugin": ["cz_bumpForTest = cz_bumpForTest:BumpfortestCz"]},
)

the bump actually works well and it's indeed bumps the patch version for the relevant commit. but the change log looks like this for all type of commits:

Screenshot 2023-07-27 at 10 19 57

there are other repositories that this list of invalid tags is very long. how to remove it? is the behavior configurable?

EDIT

after going deeper in the code I found the following pr https://github.com/commitizen-tools/commitizen/commit/8123bcb1a799f17a4630592945d3764f202308d4 which I see now the function get_version_tags generates this kind of messages

is there a way to override it? or disable this warning? my repositories has tags that are not semver

Steps to reproduce

I am wrapping the cz cli using python code but eventully I call the command cz ch --dry-run --start-rev <original_tag> --unreleased-version "<new_tag>"

Current behavior

the release notes contains invalid tags messages

Desired behavior

I dont expect it to add all those invalid tags to the release notes

Screenshots

No response

Environment

I am using the latest versions

YoniRomm avatar Jul 27 '23 07:07 YoniRomm

I am experiencing this as well. I think a quick fix is to write out.warn messages to stderr instead of stdout.

melsabagh avatar Sep 18 '23 13:09 melsabagh

Have you tried using git_redirect_stderr ?

woile avatar Sep 18 '23 13:09 woile

@woile, yes, it doesn't seem related. The "InvalidVersion GitTag(...)" warning is printed by cz itself here: https://github.com/commitizen-tools/commitizen/blob/b8c0c7c780652d68a2b60bad8379f22418110e5f/commitizen/changelog.py#L83

melsabagh avatar Sep 18 '23 14:09 melsabagh

We see this with our (old) non-semver tags, as well.

Is there a way to specify "ignore tag XYZ" in .cz.toml or otherwise filter this warning out?

Thanks.

eortega-pjr avatar Oct 06 '23 22:10 eortega-pjr

Hi all, I just tested with the latest version with cz ch without encountering this issue. It seems to be fixed in 3.18.3 (Thanks @noirbizarre !). I'm going to close this one. But please feel free to reopen it if the issue persists. Thanks! 🙂

Lee-W avatar May 20 '24 21:05 Lee-W