Skip to content

Commit 6e0266c

Browse files
committed
feat(syntax-fa): add pre-commit rules
1 parent e8fd3e6 commit 6e0266c

File tree

5 files changed

+68
-0
lines changed

5 files changed

+68
-0
lines changed

.gitlint

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[general]
2+
ignore=body-is-missing
3+
4+
[title-max-length]
5+
line-length=72
6+
7+
[title-min-length]
8+
min-length=3
9+
10+
[title-match-regex]
11+
regex=^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?: .+$

.pre-commit-config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: install-dependencies
5+
name: Install dependencies
6+
entry: bash -c 'pip install -r requirements/production.txt'
7+
language: system
8+
always_run: true
9+
10+
- id: gitlint
11+
name: Run gitlint
12+
entry: gitlint
13+
language: python
14+
stages: [commit-msg]
15+
args: [--contrib=CT1, --msg-filename]
16+
17+
- id: pylint
18+
name: Run pylint
19+
entry: pylint
20+
language: python
21+
types: [python]

docs/pre-commit.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
### Pre commit
2+
3+
## for install dependencies:
4+
```shell
5+
pre-commit clean
6+
&&
7+
pre-commit install
8+
&&
9+
pre-commit install --hook-type commit-msg
10+
```
11+
12+
## for applying new added rule:
13+
```shell
14+
pre-commit clean &&
15+
pre-commit install Or pre-commit install --hook-type commit-msg
16+
```
17+
18+
## running pre-commit for test
19+
```shell
20+
pre-commit run --all-files
21+
```
22+
23+
## testing gitlint
24+
```shell
25+
echo "bad commit message" > test_commit_msg.txt
26+
&&
27+
gitlint --msg-filename test_commit_msg.txt
28+
```
29+
30+
## Or:
31+
```shell
32+
pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_EDITMSG
33+
```

requirements/base.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ django-redis==5.4.0
55
djangorestframework==3.15.2
66
drf-spectacular==0.28.0
77
pylint==3.3.2
8+
pre-commit==4.0.1
9+
gitlint==0.19.1

test_commit_msg.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bad commit message

0 commit comments

Comments
 (0)