Skip to content

Commit 7fbbd8e

Browse files
authored
Merge pull request #305 from JamesParrott/Synced_with_PyShp
Add ruff format hook to pre-commit config, target Python 3.7, turn it off (for Python 2) where it adds trailing comma after *args
2 parents 35ad714 + eee6180 commit 7fbbd8e

File tree

4 files changed

+1310
-738
lines changed

4 files changed

+1310
-738
lines changed

.pre-commit-config.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ repos:
99
hooks:
1010
- id: isort
1111
name: isort (python)
12-
12+
- repo: https://github.com/astral-sh/ruff-pre-commit
13+
rev: v0.6.4
14+
hooks:
15+
- id: ruff-format

pyproject.toml

+66
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,72 @@
22
requires = ["setuptools"]
33
build-backend = "setuptools.build_meta"
44

5+
6+
[tool.ruff]
7+
# Exclude a variety of commonly ignored directories.
8+
exclude = [
9+
".bzr",
10+
".direnv",
11+
".eggs",
12+
".git",
13+
".git-rewrite",
14+
".hg",
15+
".ipynb_checkpoints",
16+
".mypy_cache",
17+
".nox",
18+
".pants.d",
19+
".pyenv",
20+
".pytest_cache",
21+
".pytype",
22+
".ruff_cache",
23+
".svn",
24+
".tox",
25+
".venv",
26+
".vscode",
27+
"__pypackages__",
28+
"_build",
29+
"buck-out",
30+
"build",
31+
"dist",
32+
"node_modules",
33+
"site-packages",
34+
"venv",
35+
]
36+
37+
# Same as Black.
38+
line-length = 88
39+
indent-width = 4
40+
41+
# Assume Python 3.9
42+
target-version = "py37"
43+
44+
[tool.ruff.lint]
45+
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
46+
select = ["E4", "E7", "E9", "F"]
47+
ignore = []
48+
49+
# Allow fix for all enabled rules (when `--fix`) is provided.
50+
fixable = ["ALL"]
51+
unfixable = []
52+
53+
# Allow unused variables when underscore-prefixed.
54+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
55+
56+
[tool.ruff.format]
57+
# Like Black, use double quotes for strings.
58+
quote-style = "double"
59+
60+
# Like Black, indent with spaces, rather than tabs.
61+
indent-style = "space"
62+
63+
# Like Black, respect magic trailing commas.
64+
skip-magic-trailing-comma = false
65+
66+
# Like Black, automatically detect the appropriate line ending.
67+
line-ending = "auto"
68+
69+
70+
571
[tool.pylint.MASTER]
672
load-plugins=[
773
"pylint_per_file_ignores",

0 commit comments

Comments
 (0)