Skip to content

Commit c8244eb

Browse files
committed
docs: update contribution guidelines
Update the contribution guidelines to enforce proper commit message format.
1 parent 4a80280 commit c8244eb

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

CONTRIBUTING.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
When contributing to this repository, please first discuss the change you wish to make via issue,
44
email, or any other method with the owners of this repository before making a change. This avoids extra work for both you and us.
55

6+
You must follow the [commit message guidelines](#commit-message-guidelines).
7+
68
## Pull Request Process
79

810
1. Fork the repo and create your branch from `master`.
@@ -18,3 +20,89 @@ You can read our licence [here](https://github.com/scriptcoded/sql-highlight/blo
1820

1921
## License
2022
By contributing, you agree that your contributions will be licensed under its MIT License.
23+
24+
## Commit message guidelines
25+
26+
> These guidelines were taken from the [semantic-release contribution guidelines](https://github.com/semantic-release/semantic-release/blob/master/CONTRIBUTING.md#commit-message-guidelines)
27+
28+
### Atomic commits
29+
30+
If possible, make [atomic commits](https://en.wikipedia.org/wiki/Atomic_commit), which means:
31+
- a commit should contain exactly one self-contained functional change
32+
- a functional change should be contained in exactly one commit
33+
- a commit should not create an inconsistent state (such as test errors, linting errors, partial fix, feature with documentation etc...)
34+
35+
A complex feature can be broken down into multiple commits as long as each one maintains a consistent state and consists of a self-contained change.
36+
37+
### Commit message format
38+
39+
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special format that includes a **type**, a **scope** and a **subject**:
40+
41+
```commit
42+
<type>(<scope>): <subject>
43+
<BLANK LINE>
44+
<body>
45+
<BLANK LINE>
46+
<footer>
47+
```
48+
49+
The **header** is mandatory and the **scope** of the header is optional.
50+
51+
The **footer** can contain a [closing reference to an issue](https://help.github.com/articles/closing-issues-via-commit-messages).
52+
53+
### Revert
54+
55+
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit. In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
56+
57+
### Type
58+
59+
The type must be one of the following:
60+
61+
| Type | Description |
62+
|--------------|-------------------------------------------------------------------------------------------------------------|
63+
| **build** | Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm) |
64+
| **ci** | Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs) |
65+
| **docs** | Documentation only changes |
66+
| **feat** | A new feature |
67+
| **fix** | A bug fix |
68+
| **perf** | A code change that improves performance |
69+
| **refactor** | A code change that neither fixes a bug nor adds a feature |
70+
| **style** | Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) |
71+
| **test** | Adding missing tests or correcting existing tests |
72+
73+
### Subject
74+
75+
The subject contains succinct description of the change:
76+
77+
- use the imperative, present tense: "change" not "changed" nor "changes"
78+
- don't capitalize first letter
79+
- no dot (.) at the end
80+
81+
### Body
82+
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
83+
The body should include the motivation for the change and contrast this with previous behavior.
84+
85+
### Footer
86+
The footer should contain any information about **Breaking Changes** and is also the place to reference GitHub issues that this commit **Closes**.
87+
88+
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this.
89+
90+
### Examples
91+
92+
```commit
93+
fix(pencil): stop graphite breaking when too much pressure applied
94+
```
95+
96+
```commit
97+
feat(pencil): add 'graphiteWidth' option
98+
99+
Fix #42
100+
```
101+
102+
```commit
103+
perf(pencil): remove graphiteWidth option
104+
105+
BREAKING CHANGE: The graphiteWidth option has been removed.
106+
107+
The default graphite width of 10mm is always used for performance reasons.
108+
```

0 commit comments

Comments
 (0)