Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(config): fix default regexes and references in docs #7

Merged
merged 4 commits into from
Sep 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,13 @@ An array of commit parsers for determining the commit groups by using regex.

Examples:

- `{ message = "^feat*", group = "Features"}`
- `{ message = "^feat", group = "Features"}`
- Group the commit as "Features" if the commit message (description) starts with "feat".
- `{ body = ".*security", group = "Security"}`
- Group the commit as "Security" if the commit body contains "security".
- `{ message = ".*deprecated", body = ".*deprecated", group = "Deprecation"}`
- Group the commit as "Deprecation" if the commit body and message contains "deprecated".
- `{ message = "^revert*", skip = true}`
- `{ message = "^revert", skip = true}`
- Skip processing the commit if the commit message (description) starts with "revert".
- `{ message = "^doc*", group = "Documentation", default_scope = "other"},`
- If the commit starts with "doc", group the commit as "Documentation" and set the default scope to "other". (e.g. `docs: xyz` will be processed as `docs(other): xyz`)
Expand Down
18 changes: 9 additions & 9 deletions config/cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ footer = """
conventional_commits = true
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat*", group = "Features"},
{ message = "^fix*", group = "Bug Fixes"},
{ message = "^doc*", group = "Documentation"},
{ message = "^perf*", group = "Performance"},
{ message = "^refactor*", group = "Refactor"},
{ message = "^style*", group = "Styling"},
{ message = "^test*", group = "Testing"},
{ message = "^chore\\(release\\): prepare for*", skip = true},
{ message = "^chore*", group = "Miscellaneous Tasks"},
{ message = "^feat", group = "Features"},
{ message = "^fix", group = "Bug Fixes"},
{ message = "^doc", group = "Documentation"},
{ message = "^perf", group = "Performance"},
{ message = "^refactor", group = "Refactor"},
{ message = "^style", group = "Styling"},
{ message = "^test", group = "Testing"},
{ message = "^chore\\(release\\): prepare for", skip = true},
{ message = "^chore", group = "Miscellaneous Tasks"},
{ body = ".*security", group = "Security"},
]
# filter out the commits that are not matched by commit parsers
Expand Down
18 changes: 9 additions & 9 deletions examples/detailed.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ footer = """
conventional_commits = true
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat*", group = "Features"},
{ message = "^fix*", group = "Bug Fixes"},
{ message = "^doc*", group = "Documentation"},
{ message = "^perf*", group = "Performance"},
{ message = "^refactor*", group = "Refactor"},
{ message = "^style*", group = "Styling"},
{ message = "^test*", group = "Testing"},
{ message = "^chore\\(release\\): prepare for*", skip = true},
{ message = "^chore*", group = "Miscellaneous Tasks"},
{ message = "^feat", group = "Features"},
{ message = "^fix", group = "Bug Fixes"},
{ message = "^doc", group = "Documentation"},
{ message = "^perf", group = "Performance"},
{ message = "^refactor", group = "Refactor"},
{ message = "^style", group = "Styling"},
{ message = "^test", group = "Testing"},
{ message = "^chore\\(release\\): prepare for", skip = true},
{ message = "^chore", group = "Miscellaneous Tasks"},
{ body = ".*security", group = "Security"},
]
# filter out the commits that are not matched by commit parsers
Expand Down
16 changes: 8 additions & 8 deletions examples/keepachangelog.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ footer = """
conventional_commits = true
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^*: add*", group = "Added"},
{ message = "^*: support*", group = "Added"},
{ message = "^*: remove*", group = "Removed"},
{ message = "^*: delete*", group = "Removed"},
{ message = "^test*", group = "Fixed"},
{ message = "^fix*", group = "Fixed"},
{ message = "^*: fix*", group = "Fixed"},
{ message = "^*", group = "Changed"},
{ message = "^.*: add", group = "Added"},
{ message = "^.*: support", group = "Added"},
{ message = "^.*: remove", group = "Removed"},
{ message = "^.*: delete", group = "Removed"},
{ message = "^test", group = "Fixed"},
{ message = "^fix", group = "Fixed"},
{ message = "^.*: fix", group = "Fixed"},
{ message = "^.*", group = "Changed"},
]
# filter out the commits that are not matched by commit parsers
filter_commits = true
Expand Down
16 changes: 8 additions & 8 deletions examples/scoped.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ footer = """
conventional_commits = true
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat*", group = "Features"},
{ message = "^fix*", group = "Bug Fixes"},
{ message = "^feat", group = "Features"},
{ message = "^fix", group = "Bug Fixes"},
{ message = "^doc*", group = "Documentation", default_scope = "unscoped"},
{ message = "^perf*", group = "Performance"},
{ message = "^refactor*", group = "Refactor"},
{ message = "^style*", group = "Styling"},
{ message = "^test*", group = "Testing"},
{ message = "^chore\\(release\\): prepare for*", skip = true},
{ message = "^chore*", group = "Miscellaneous Tasks"},
{ message = "^perf", group = "Performance"},
{ message = "^refactor", group = "Refactor"},
{ message = "^style", group = "Styling"},
{ message = "^test", group = "Testing"},
{ message = "^chore\\(release\\): prepare for", skip = true},
{ message = "^chore", group = "Miscellaneous Tasks"},
{ body = ".*security", group = "Security"},
]
# filter out the commits that are not matched by commit parsers
Expand Down
8 changes: 6 additions & 2 deletions git-cliff-core/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ fn generate_changelog() -> Result<()> {
conventional_commits: true,
commit_parsers: Some(vec![
CommitParser {
message: Regex::new("feat*").ok(),
message: Regex::new("^feat").ok(),
body: None,
group: Some(String::from("shiny features")),
default_scope: None,
skip: None,
},
CommitParser {
message: Regex::new("fix*").ok(),
message: Regex::new("^fix").ok(),
body: None,
group: Some(String::from("fix bugs")),
default_scope: None,
Expand All @@ -58,6 +58,10 @@ fn generate_changelog() -> Result<()> {
Commit::new(String::from("abc124"), String::from("feat: add zyx")),
Commit::new(String::from("def789"), String::from("invalid commit")),
Commit::new(String::from("qwerty"), String::from("fix: fix abc")),
Commit::new(
String::from("qwop"),
String::from("final: invalid commit"),
),
Commit::new(
String::from("hjkl12"),
String::from("chore: do boring stuff"),
Expand Down