Skip to content

Commit 5341db2

Browse files
authored
misc: add pre-commit to project (#107)
Facilitates enforcing same formatter to all and also rulling out things like pushing debug statements :)
1 parent c113799 commit 5341db2

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

.pre-commit-config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 22.10.0
4+
language_version: python3.9
5+
hooks:
6+
- id: black
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: v4.4.0
9+
hooks:
10+
- id: trailing-whitespace
11+
- id: debug-statements
12+
- repo: https://github.com/charliermarsh/ruff-pre-commit
13+
rev: 'v0.0.261'
14+
hooks:
15+
- id: ruff

pyproject.toml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[tool.black]
2+
line-length = 120
3+
skip-string-normalization = true
4+
target-version = ['py39']
5+
include = '\.pyi?$'
6+
exclude = '''
7+
/(
8+
\.eggs
9+
| \.git
10+
| \.hg
11+
| \.mypy_cache
12+
| \.tox
13+
| \.venv
14+
| \.venv3
15+
| _build
16+
| buck-out
17+
| build
18+
| dist
19+
| migrations
20+
)/
21+
'''
22+
23+
[tool.ruff]
24+
exclude = [
25+
'.git',
26+
'__pycache__',
27+
'venv',
28+
'venv3',
29+
]
30+
ignore = []
31+
line-length = 120
32+
select = [
33+
'E',
34+
'F',
35+
'W',
36+
"I001",
37+
]
38+
src = ['surface', 'e2e']
39+
40+
[tool.ruff.isort]
41+
known-first-party = ["theme", "dkron", "django_restful_admin", "slackbot", "dbcleanup", "olympus", "notifications", "ppbenviron", "logbasecommand", "impersonate", "apitokens"]

surface/requirements_dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
black==22.8.0
44
django-debug-toolbar==3.7.0
5+
pre-commit==3.2.2
56
pylint==2.17.1
67
pylint-django==2.5.3
78

0 commit comments

Comments
 (0)