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

chore: add commitlint and husky #128

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 29 additions & 0 deletions .commitlintrc.yml
@@ -0,0 +1,29 @@
extends:
- '@commitlint/config-conventional'
rules:
header-max-length: [1, 'always', 72]
type-enum:
- 2
- always
- - ci
- feat
- fix
- docs
- style
- refactor
- perf
- test
- revert
- chore
help: |
**Possible types**:
`ci`: Changes to our CI configuration files and scripts (example scopes: Travis, Circle CI, BrowserStack, SauceLabs)
`feat`: Adds a new feature.
`fix`: Solves a bug.
`docs`: Adds or alters documentation. (example scopes: readme, worker, code_of_conduct, contributors)
`style`: Improves formatting, white-space.
`refactor`: Rewrites code without feature, performance or bug changes.
`perf`: Improves performance.
`test`: Adds or modifies tests. (example scopes: functionals, unit-tests)
`revert`: Changes that reverting other changes
`chore`: No production code change. Updating grunt tasks etc;
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -19,6 +19,17 @@ Please read project contribution
[guide](https://github.com/open-telemetry/community/blob/master/CONTRIBUTING.md)
for general practices for OpenTelemetry project.

#### Conventional commit

The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of. This convention dovetails with SemVer, by describing the features, fixes, and breaking changes made in commit messages. You can see examples [here](https://www.conventionalcommits.org/en/v1.0.0-beta.4/#examples).
We use [commitlint](https://github.com/conventional-changelog/commitlint) and [husky](https://github.com/typicode/husky) to prevent bad commit message.
For example, you want to submit the following commit message `git commit -s -am "my bad commit"`.
You will receive the following error :
```
✖ type must be one of [ci, feat, fix, docs, style, refactor, perf, test, revert, chore] [type-enum]
```
Here an exemple that will pass the verification: `git commit -s -am "chore(opentelemetry-core): update deps"`

### Fork

In the interest of keeping this repository clean and manageable, you should work from a fork. To create a fork, click the 'Fork' button at the top of the repository, then clone the fork locally using `git clone git@github.com:USERNAME/opentelemetry-js.git`.
Expand Down
8 changes: 8 additions & 0 deletions package.json
Expand Up @@ -27,7 +27,15 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"devDependencies": {
"@commitlint/cli": "^8.1.0",
"@commitlint/config-conventional": "^8.1.0",
"husky": "^3.0.1",
"lerna": "^3.13.4",
"typescript": "^3.4.5"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
}