Skip to content

The cz ch command generates a CHANGELOG.md that includes the content from the body. #1267

Open
@gbaian10

Description

@gbaian10

Description

When I use the cz ch command, I only want it to capture the title part and not read or parse the body part.

Currently, I guess that this piece of code is parsing the body.

image

I'm not sure if my input and output situation matches your expected output.
However, I hope it doesn't parse the content of the body.
If this result is what you originally expected, I would like to add a flag to stop parsing the body.

Steps to reproduce

My commit message:

image

Current behavior

image

Desired behavior

image

Screenshots

No response

Environment

cz-version==3.29.1
python-version==3.12.7
operating system==window10

Activity

Lee-W

Lee-W commented on Oct 20, 2024

@Lee-W
Member

Whether to include the content from the body is something we probably could make it configurable. But will probably need to check whether it makes sense to other cz rules. If not, how we can make it happen.

Also, the example you provide doesn't look right 🤔 It should be

### refactor
* 12 

fix: ...
feat:

It's at least a bug we would like it to be fixed.

gbaian10

gbaian10 commented on Oct 20, 2024

@gbaian10
ContributorAuthor

I'm not sure which incorrect example you're talking about, the current output or the expected output?

The current logic always splits the body section with \n\n, then uses strings starting with keywords like feat, fix, refactor, perf, or BREAKING CHANGE as part of the changelog.

Here are more current output examples.


image

Body "feat" is connected to the previous line "Hello World!" and they are treated as one string, failing the regex check and being ignored.


image

The two paragraphs are separate. "Hello World" fails the regex check and won't be displayed, but "feat" will appear in the changelog.


image

There is no body section, but the title has two lines that are ultimately connected into a single string.
However, when the body section has multiple lines, the line breaks are preserved, and they are not connected into one string.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      The `cz ch` command generates a `CHANGELOG.md` that includes the content from the body. · Issue #1267 · commitizen-tools/commitizen