Skip to content

Commit 085294b

Browse files
authored
Merge pull request #216 from commitizen-tools/add-pre-commit-integration
Add pre commit integration
2 parents ed1ccab + 4fddcbe commit 085294b

File tree

10 files changed

+46
-12
lines changed

10 files changed

+46
-12
lines changed

.codacy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
exclude_paths:
22
- 'tests/**'
3-
- 'docs/**'
3+
- 'docs/**'

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Please put an `x` in the box that applies
1515

1616
## Checklist:
1717
- [ ] Add test cases to all the changes you introduce
18-
- [ ] Run `./script/lint` and `./script/test` locally to ensure this change passes linter check and test
18+
- [ ] Run `./script/reformat` and `./script/test` locally to ensure this change passes linter check and test
1919
- [ ] Test the changes on the local machine manually
2020
- [ ] Update the documentation for the changes
2121

.github/workflows/pythonpublish.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,3 @@ jobs:
2828
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
2929
run: |
3030
./scripts/publish
31-

.pre-commit-config.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
default_stages: [push]
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v3.1.0
5+
hooks:
6+
- id: check-vcs-permalinks
7+
- id: end-of-file-fixer
8+
- id: trailing-whitespace
9+
args: [--markdown-linebreak-ext=md]
10+
- id: debug-statements
11+
- id: no-commit-to-branch
12+
13+
- repo: https://github.com/Woile/commitizen
14+
rev: v1.23.0
15+
hooks:
16+
- id: commitizen
17+
stages: [commit-msg]
18+
19+
- repo: local
20+
hooks:
21+
- id: reformat
22+
name: reformat
23+
language: system
24+
pass_filenames: false
25+
entry: ./scripts/reformat
26+
types: [python]
27+
28+
- id: linter and test
29+
name: linter and test
30+
language: system
31+
pass_filenames: false
32+
entry: ./scripts/test
33+
types: [python]

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

commitizen/cz/conventional_commits/conventional_commits_info.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ information and is contained within parenthesis, e.g., feat(parser): add ability
2828

2929
[optional body]
3030

31-
[optional footer]
31+
[optional footer]

docs/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ cz c
7777
### Integrating with Pre-commit
7878
Commitizen can lint your commit message for you with `cz check`.
7979
You can integrate this in your [pre-commit](https://pre-commit.com/) config with:
80+
8081
```yaml
8182
---
8283
repos:
@@ -86,6 +87,7 @@ repos:
8687
- id: commitizen
8788
stages: [commit-msg]
8889
```
90+
8991
Read more about the `check` command [here](https://commitizen-tools.github.io/commitizen/check/).
9092

9193
### Help

docs/contributing.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ If you're a first-time contributor, you can check the issues with [good first is
1111
1. Fork [the repository](https://github.com/commitizen-tools/commitizen).
1212
2. Clone the repository from your GitHub.
1313
3. Setup development environment through [poetry](https://python-poetry.org/) (`poetry install`).
14-
4. Check out a new branch and add your modification.
15-
5. Add test cases for all your changes.
14+
4. Setup [pre-commit](https://pre-commit.com/) hook (`pre-commit install -t pre-commit -t pre-push -t commit-msg`)
15+
5. Check out a new branch and add your modification.
16+
6. Add test cases for all your changes.
1617
(We use [CodeCov](https://codecov.io/) to ensure our test coverage does not drop.)
17-
6. Use [commitizen](https://github.com/commitizen-tools/commitizen) to do git commit.
18-
7. Run `./scripts/lint` and `./scripts/test` to ensure you follow the coding style and the tests pass.
19-
8. Update `READMD.md` and `CHANGELOG.md` for your changes.
20-
9. Send a [pull request](https://github.com/commitizen-tools/commitizen/pulls) 🙏
18+
7. Use [commitizen](https://github.com/commitizen-tools/commitizen) to do git commit.
19+
8. Run `./scripts/reformat` and `./scripts/test` to ensure you follow the coding style and the tests pass.
20+
9. Update `READMD.md` and `CHANGELOG.md` for your changes.
21+
10. Send a [pull request](https://github.com/commitizen-tools/commitizen/pulls) 🙏

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,3 @@ line_length = 88
109109
[build-system]
110110
requires = ["poetry>=0.12"]
111111
build-backend = "poetry.masonry.api"
112-
File renamed without changes.

0 commit comments

Comments
 (0)