Skip to content

Commit

Permalink
fix(config): fix default regexes and references in docs (#7)
Browse files Browse the repository at this point in the history
* Fix default regexes and references in docs

* correction: I didn't realize the colon was necessary

* change more tomls, fmt

* rebase fixes
  • Loading branch information
Groxx authored Sep 8, 2021
1 parent b5edfc2 commit 8a18e4d
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 38 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,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

0 comments on commit 8a18e4d

Please sign in to comment.