Skip to content

Commit 4f78ef1

Browse files
committed
add a basic pre-commit config
1 parent 232b548 commit 4f78ef1

File tree

4 files changed

+109
-1
lines changed

4 files changed

+109
-1
lines changed

Diff for: .pre-commit-config.yaml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
repos:
3+
- repo: https://github.com/psf/black
4+
rev: 23.3.0
5+
hooks:
6+
- id: black
7+
language_version: python3
8+
- repo: https://github.com/pre-commit/pre-commit-hooks
9+
rev: v4.4.0
10+
hooks:
11+
- id: end-of-file-fixer
12+
- id: trailing-whitespace
13+
- id: mixed-line-ending
14+
- id: check-byte-order-marker
15+
- id: check-executables-have-shebangs
16+
- id: check-merge-conflict
17+
- id: check-symlinks
18+
- id: check-vcs-permalinks
19+
- id: debug-statements
20+
- id: check-yaml
21+
files: .*\.(yaml|yml)$
22+
- repo: https://github.com/codespell-project/codespell
23+
rev: v2.2.4
24+
hooks:
25+
- id: codespell
26+
name: codespell
27+
description: Checks for common misspellings in text files.
28+
entry: codespell
29+
language: python
30+
types: [text]
31+
args: []
32+
require_serial: false
33+
additional_dependencies: []
34+
- repo: https://github.com/charliermarsh/ruff-pre-commit
35+
rev: "v0.0.270"
36+
hooks:
37+
- id: ruff
38+
args: [--fix, --exit-non-zero-on-fix]
39+
- repo: https://github.com/adrienverge/yamllint
40+
rev: v1.31.0
41+
hooks:
42+
- id: yamllint
43+
files: \.(yaml|yml)$
44+
- repo: https://github.com/pre-commit/mirrors-mypy
45+
rev: v1.3.0
46+
hooks:
47+
- id: mypy
48+
additional_dependencies:
49+
- types-requests
50+
- types-pkg_resources
51+
args:
52+
[--no-strict-optional, --ignore-missing-imports, --show-error-codes]

Diff for: Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: compile debug test quicktest clean all gen-errors gen-types _touch
1+
.PHONY: compile debug lint test quicktest clean all gen-errors gen-types _touch
22

33

44
PYTHON ?= python
@@ -51,6 +51,10 @@ debug: _touch
5151
EDGEDB_DEBUG=1 $(PYTHON) setup.py build_ext --inplace
5252

5353

54+
lint:
55+
$(PYTHON) -m pip install pre-commit
56+
pre-commit run --all-files
57+
5458
test:
5559
PYTHONASYNCIODEBUG=1 $(PYTHON) setup.py test
5660
$(PYTHON) setup.py test

Diff for: pyproject.toml

+51
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,54 @@
11
[build-system]
22
requires = ["setuptools"]
33
build-backend = "setuptools.build_meta"
4+
5+
6+
########################################################################################
7+
# External Tool Config
8+
########################################################################################
9+
[tool.mypy]
10+
python_version = 3.8
11+
warn_unused_configs = true
12+
namespace_packages = true
13+
# plugins = "pydantic.mypy"
14+
15+
[tool.ruff]
16+
select = [
17+
"E", # pydocstyle
18+
"W", # pydocstyle
19+
"F", # pyflakes
20+
"I", # isort
21+
"UP", # pyupgrade
22+
"D", # docstrings
23+
"RUF", # ruff
24+
]
25+
ignore = [
26+
"D100", # Missing docstring in public module
27+
"D101", # Missing docstring in public class
28+
"D102", # Missing docstring in public method
29+
"D103", # Missing docstring in public function
30+
"D104", # Missing docstring in public package
31+
"D107", # Missing docstring in `__init__`
32+
"D105", # Missing docstring in magic method
33+
"D205" # 1 blank line required between summary line and description
34+
]
35+
36+
# Same as Black.
37+
line-length = 88
38+
39+
# Allow unused variables when underscore-prefixed.
40+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
41+
42+
# Assume Python 3.8. (minimum supported)
43+
target-version = "py38"
44+
45+
# The source code paths to consider, e.g., when resolving first- vs. third-party imports
46+
src = ["edgedb", "tests"]
47+
48+
[tool.ruff.isort]
49+
known-first-party = ["edgedb", "tests"]
50+
required-imports = ["from __future__ import annotations"]
51+
52+
[tool.ruff.pydocstyle]
53+
# Use Google-style docstrings.
54+
convention = "google"

Diff for: tests/ruff.toml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ignore = ["D101", "D102"]

0 commit comments

Comments
 (0)