-
-
Notifications
You must be signed in to change notification settings - Fork 269
Open
Labels
feature/requestNew feature or requestNew feature or request
Description
Is there an existing issue or pull request for this?
- I have searched the existing issues and pull requests
Feature description
The current configuration lacks clear structure. The naming is inconsistent and some names are fairly non-descriptive. I believe git-cliff would profit from a refactor of the configuration options, command line parameters and update of the respective documentation.
This issue is intended as a basis for discussion. I have prepared a mock-up of how I would structure the configuration when starting from scratch. Below that is a numbered list of all of the changes such they can be discussed.
Any changes to the configuration will likely be breaking changes. Thus the target should be well defined, such that it is a one-off and not the start of many smaller changes.
Desired solution
Mock-up of the new config file
[changelog]
// A static header for the changelog.
header Option<String> // changelog.header
// Tera template for the changelog's body.
body_template Option<String> // changelog.body_template
// Tera template for the changelog's footer.
footer_template Option<String> // changelog.footer
// Whether to remove leading and trailing whitespaces from all lines of the changelog's body.
trim_body_whitespace Option<String> // changelog.trim
// A list of postprocessors to modify the changelog using regex replacements.
postprocessors Option<Vec<TextProcessor>>
// Whether to exclude commits that do not match the conventional commits specification from the changelog.
exclude_unconventional_commits Option<bool> // git.filter_unconventional
// Whether to fail generating the changelog if the history contains commits that do not match the conventional commits specification.
require_conventional_commits Option<bool>
// If set to `true`, any breaking changes will be protected against being skipped due to any commit parser.
retain_breaking_changes Option<bool> // git.protect_breaking_commits
// Whether to filter out changes that do not belong to any group.
exclude_ungrouped_changes Option<bool> // git.filter_commits
[release]
// Regex to select git tags that represent releases (e.g. "v[0-9].*").
tags_pattern String // git.tag_pattern
// Regex to select git tags that do not represent proper releases (e.g. "rc"). Takes precedence over `release.tags_pattern`.
// Changes belonging to these releases will be included in the next non-skipped release.
skip_tags_pattern String // git.ignore_tags
// Whether to order releases chronologically or topologically.
order_by Enum: "time" / "topology" // git.topo_order
[commit]
// Whether to order commits newest to oldest or oldest to newest. // git.sort_commits
sort_order Enum: "newest_first" / "oldest_first"
// Whether to limit the total number of commits to be included in the changelog.
max_commit_count Option<usize> // git.limit_commits
// Whether to split commits by line, treating each line as an individual commit.
split_commits_by_newline Option<bool> // git.split_commits
// Regex to select git tags that should be excluded.
// Commits with these git tags will not be included in the changelog.
exclude_tags_pattern String // git.skip_tags
// A list of preprocessors to modify commit messages using regex replacements prior to further processing.
message_preprocessors Option<Vec<TextProcessor>> // git.commit_preprocessors
// A list of parsers to extract links from identifiers found in commits. The extracted links can be used in the body template as `commit.links`.
// e.g. "PRJ-1234" -> "https://example.com/jira/browse/PRJ-1234"
link_parsers Option<Vec<LinkParser>> // git.link_parsers
// Whether to parse commits according to the conventional commits specification.
// Sets the commits' `group`, `scope`, `message` (= `description`), `body`, `breaking`, `breaking_description` and `footers`.
parse_conventional_commits Option<bool> // git.conventional_commits
// A list of parsers using regex on the whole commit message taking presedence over conventional commit.
// Sets the commits' `group`. Optionally sets the commits' `scope`.
commit_parsers Option<Vec<CommitParser>> // git.commit_parsers
[remote.github]
owner String
repo String
token Option<Secretstring>List of changes:
- Renamed
changelog.footertochangelog.footer_templateto match naming forchangelog.body_template. - Renamed
changelog.trimtochangelog.trim_body_whitespaceto be more descriptive. git.filter_unconventional:
a Renamed toexclude_unconventional_commits, becausefiltercan be misunderstood to be inclusive.
b Moved from[git]to[changelog], because it excluding changes is a function of the changelog.git.protect_breaking_commits:
a Renamed toretain_breaking_changesto be more descriptive.
b Moved from[git]to[changelog], because retaining changes is a function of the changelog.git.filter_commits:
a Renamed toexclude_ungrouped_changesto be more descriptive. Due tosplit_commitsbeing a thing, it makes more sense to refer to it working on changes instead of commits.
b Moved from[git]to[changelog], because retaining changes is a function of the changelog.- Added section
[release]for options that act on the level of releases. git.tag_pattern:
a Renamed totags_patternto be more descriptive by including the purpose of the tags.
b Moved to[release].git.ignore_tags:
a Renamed toskip_tags_patternto be more descriptive.
b Moved to[releases].git.topo_order:
a Renamed toorder_byto be more descriptive.
b Changed type to an enum with optionstimeandtopology.
c Moved to[releases].- Renamed
[git]to[commit]to reflect that these options relate to operations on the level of commits. git.sort_commits
a Renamed tosort_orderto be more descriptive.
b Renamed possible values tonewest_firstandoldest_firstto be more descriptive.- Renamed
git.split_commitstosplit_commits_by_newlineto include that they operate on a line by line basis. - Renamed
git.skip_tagstoexclude_tags_pattern._patternis used on all regex patterns.excludeis more descriptive becauseskiphas a different meaning in the contest of releases. - Renamed
git.commit_preprocessorstomessage_preprocessorsto emphasize them modifying the message and no other property of the commit. - Renamed
git.conventional_commitstoparse_conventional_commitsto be more descriptive.
Tasks
- refactor
config.rs
-- rename properties
-- update descriptions
-- rearrange sections - update all
config.toml - update website
- refactor CLI parameters
Alternatives considered
none
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature/requestNew feature or requestNew feature or request