commitizen icon indicating copy to clipboard operation
commitizen copied to clipboard

Changelog change type sections are ordered "incorrectly"

Open lobotmcj opened this issue 3 years ago • 1 comments

Description

The default value for change_type_order uses lower-case "feat", "perf", etc instead of "Feat", "Perf", and is therefore ignored in changelog output

Steps to reproduce

  1. mkdir /tmp/cztest && cd /tmp/cztest
  2. git init
  3. touch foo && git add foo && git commit -m "feat: first commit"
  4. touch foo2 && git add foo2 && git commit -m "perf: second commit" image
  5. cz ch --dry-run image
  6. echo -e "[tool.commitizen]\nchange_type_order = [\"Feat\", \"Perf\"]" > pyproject.toml
  7. cz ch --dry-run image

Current behavior

The default change_type_order is ineffective and pre #323 LIFO ordering is used in the changelog

Desired behavior

Changelog sections should be ordered according to https://github.com/commitizen-tools/commitizen/blob/master/commitizen/defaults.py#L43

Environment

  • commitizen version: 2.17.12
  • python version: 3.6.9
  • operating system: Linux

lobotmcj avatar Jul 11 '21 20:07 lobotmcj

I'm not positive, but as far as I can tell, this only is in effect when using cz_conventional_commits and is caused by the change_type_map which maps "perf" to "Perf", etc here: https://github.com/commitizen-tools/commitizen/blob/aa0debe9ae5939afb54de5f26c7f0c395894e330/commitizen/cz/conventional_commits/conventional_commits.py#L35-L40

An alternate fix to the PR I submitted might be to just change/remove this change_type_map, but I have not tested this (nor do I know if this would somehow break conventional commits convention or be otherwise undesirable).

lobotmcj avatar Jul 11 '21 20:07 lobotmcj

closed by #403

Lee-W avatar Aug 21 '22 15:08 Lee-W