Skip to content

Commit bf053f4

Browse files
Merge pull request #3 from espressif/update/commit-msg-default-types
change(rule-commit-messages): add "test:" to the default list of allowed types
2 parents e18f632 + 02d4a9d commit bf053f4

File tree

4 files changed

+27
-24
lines changed

4 files changed

+27
-24
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
---
2+
minimum_pre_commit_version: 3.3.0
23
default_install_hook_types: [pre-commit, commit-msg]
4+
default_stages: [pre-commit]
5+
36
repos:
47
- repo: https://github.com/pre-commit/pre-commit-hooks
58
rev: v4.5.0

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -91,23 +91,23 @@ If your project has specific needs, Shared GitHub DangerJS can be configured to
9191
9292
**Here is complete list of configurable parameters:**
9393
94-
| Parameter | CI Variable | Type | Default value |
95-
| ------------------------------------------------------ | -------------------------------------- | ---- | -------------------------------------------------- |
96-
| Enable rule PR Description | `rule-description` | str | `"true"` (use `"false"` to disable this rule) |
97-
| Enable rule PR Lint Commit Messages | `rule-commit-messages` | str | `"true"` (use `"false"` to disable this rule) |
98-
| Enable rule PR Size (changed lines) | `rule-size-lines` | str | `"true"` (use `"false"` to disable this rule) |
99-
| Enable rule PR Source branch name | `rule-source-branch` | str | `"true"` (use `"false"` to disable this rule) |
100-
| Enable rule PR Target branch name | `rule-target-branch` | str | `"true"` (use `"false"` to disable this rule) |
101-
| Enable rule PR Too Many Commits | `rule-max-commits` | str | `"true"` (use `"false"` to disable this check) |
102-
| Commit message allowed "Type"s | `commit-messages-types` | str | `"change,ci,docs,feat,fix,refactor,remove,revert"` |
103-
| Commit message maximum length "Body" line | `commit-messages-max-body-line-length` | str | `"100"` |
104-
| Commit message maximum length "Summary" | `commit-messages-max-summary-length` | str | `"72"` |
105-
| Commit message minimum length "Summary" | `commit-messages-min-summary-length` | str | `"20"` |
106-
| Ignore sections of PR description when counting length | `description-ignore-sections` | str | `"related,release,breaking"` |
107-
| Maximum changed code lines in PR | `max-size-lines` | str | `"1000"` |
108-
| Maximum commits in PR (soft limit, throw `info`) | `max-commits-info` | str | `"2"` |
109-
| Maximum commits in PR (hard limit, throw `warn`) | `max-commits-warn` | str | `"5"` |
110-
| Minimum length of PR description | `description-min-length` | str | `"50"` |
94+
| Parameter | CI Variable | Type | Default value |
95+
| ------------------------------------------------------ | -------------------------------------- | ---- | ------------------------------------------------------- |
96+
| Enable rule PR Description | `rule-description` | str | `"true"` (use `"false"` to disable this rule) |
97+
| Enable rule PR Lint Commit Messages | `rule-commit-messages` | str | `"true"` (use `"false"` to disable this rule) |
98+
| Enable rule PR Size (changed lines) | `rule-size-lines` | str | `"true"` (use `"false"` to disable this rule) |
99+
| Enable rule PR Source branch name | `rule-source-branch` | str | `"true"` (use `"false"` to disable this rule) |
100+
| Enable rule PR Target branch name | `rule-target-branch` | str | `"true"` (use `"false"` to disable this rule) |
101+
| Enable rule PR Too Many Commits | `rule-max-commits` | str | `"true"` (use `"false"` to disable this check) |
102+
| Commit message allowed "Type"s | `commit-messages-types` | str | `"change,ci,docs,feat,fix,refactor,remove,revert,test"` |
103+
| Commit message maximum length "Body" line | `commit-messages-max-body-line-length` | str | `"100"` |
104+
| Commit message maximum length "Summary" | `commit-messages-max-summary-length` | str | `"72"` |
105+
| Commit message minimum length "Summary" | `commit-messages-min-summary-length` | str | `"20"` |
106+
| Ignore sections of PR description when counting length | `description-ignore-sections` | str | `"related,release,breaking"` |
107+
| Maximum changed code lines in PR | `max-size-lines` | str | `"1000"` |
108+
| Maximum commits in PR (soft limit, throw `info`) | `max-commits-info` | str | `"2"` |
109+
| Maximum commits in PR (hard limit, throw `warn`) | `max-commits-warn` | str | `"5"` |
110+
| Minimum length of PR description | `description-min-length` | str | `"50"` |
111111

112112
These values can be defined in your project `DangerJS Pull Request linter` workflow, for example like this:
113113

src/configParameters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const defaults = {
1515
prDescription: { enabled: true, minLength: 50, ignoredSections: 'related,release,breaking' },
1616
commitMessages: {
1717
enabled: true,
18-
allowedTypes: 'change,ci,docs,feat,fix,refactor,remove,revert',
18+
allowedTypes: 'change,ci,docs,feat,fix,refactor,remove,revert,test',
1919
minSummaryLength: 20,
2020
maxSummaryLength: 72,
2121
maxBodyLineLength: 100,

tests/ruleCommitMessages.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ describe('TESTS: Commit messages style', () => {
2626
jest.doMock('../src/configParameters', () => ({
2727
config: {
2828
...originalConfig,
29-
commitMessages: {
30-
maxBodyLineLength: 100,
31-
maxSummaryLength: 72,
32-
minSummaryLength: 20,
33-
allowedTypes: 'change,ci,docs,feat,fix,refactor,remove,revert',
34-
},
3529
},
3630
recordRuleExitStatus,
3731
}));
@@ -44,6 +38,12 @@ describe('TESTS: Commit messages style', () => {
4438
expect(warn).not.toHaveBeenCalled();
4539
});
4640

41+
it('EXPECT PASS: Message with "scope" and "body", type "test"', async () => {
42+
danger.git.commits = [{ message: 'test(bootloader): This is commit message with scope and body\n\nThis is a text of body' }];
43+
await ruleCommitMessages();
44+
expect(warn).not.toHaveBeenCalled();
45+
});
46+
4747
it('EXPECT PASS: Message with "scope", without "body"', async () => {
4848
danger.git.commits = [{ message: 'change(wifi): This is commit message with scope without body' }];
4949
await ruleCommitMessages();

0 commit comments

Comments
 (0)