Skip to content

Commit 41b088d

Browse files
beliaev-maksimcsernazs
authored andcommitted
add pre-commit hooks
1 parent 8704fb0 commit 41b088d

4 files changed

Lines changed: 45 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ jobs:
1616
- name: Bootstrap environment
1717
run: |
1818
make dev EXTRAS=test
19+
- name: Style
20+
run: |
21+
make precommit
1922
- name: Lint
2023
run: |
21-
make cs mypy
24+
make mypy
2225
2326
test:
2427
name: Test with python ${{ matrix.python-version }}

.pre-commit-config.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 22.3.0
4+
hooks:
5+
- id: black
6+
args: [--line-length=120, --safe]
7+
8+
- repo: https://github.com/pre-commit/pre-commit-hooks
9+
rev: v4.1.0
10+
hooks:
11+
- id: check-case-conflict
12+
- id: check-merge-conflict
13+
- id: check-symlinks
14+
- id: end-of-file-fixer
15+
- id: trailing-whitespace
16+
- id: debug-statements
17+
- id: requirements-txt-fixer
18+
19+
- repo: https://github.com/pycqa/isort
20+
rev: 5.10.1
21+
hooks:
22+
- id: isort
23+
name: isort (python)
24+
args: ['--force-single-line-imports', '--profile', 'black']
25+
26+
- repo: https://github.com/pycqa/flake8
27+
rev: 4.0.1
28+
hooks:
29+
- id: flake8
30+
args: [ '--max-line-length', '120', '--max-doc-length', '120' ]
31+
32+
- repo: https://github.com/asottile/blacken-docs
33+
rev: v1.12.1
34+
hooks:
35+
- id: blacken-docs
36+
additional_dependencies: [ black ]

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ venv: .venv/.st-venv-completed
1313
.PHONY: dev
1414
dev: venv
1515

16-
.PHONY: cs
17-
cs: venv
18-
.venv/bin/flake8 pytest_httpserver tests
16+
.PHONY: precommit
17+
precommit: venv
18+
pre-commit run -a -v
1919

2020
.PHONY: mypy
2121
mypy: venv

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ types-requests = { version = "*", optional = true }
5353

5454
[tool.poetry.extras]
5555
dev = [
56-
"flake8",
5756
"pytest",
5857
"pytest-cov",
5958
"coverage",
@@ -62,9 +61,9 @@ dev = [
6261
"sphinx",
6362
"sphinx_rtd_theme",
6463
"reno",
65-
"autopep8",
6664
"mypy",
6765
"types-requests",
66+
"pre-commit",
6867
]
6968

7069
test = [
@@ -75,6 +74,7 @@ test = [
7574
"requests",
7675
"mypy",
7776
"types-requests",
77+
"pre-commit",
7878
]
7979

8080
doc = [

0 commit comments

Comments
 (0)