Skip to content

Commit 601b30c

Browse files
committed
pre-commit: add ruff hook
1 parent f9fd032 commit 601b30c

File tree

2 files changed

+48
-6
lines changed

2 files changed

+48
-6
lines changed

.pre-commit-config.yaml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
1+
# pre-commit is a tool to perform a predefined set of tasks manually and/or
2+
# automatically before git commits are made.
3+
#
4+
# Config reference: https://pre-commit.com/#pre-commit-configyaml---top-level
5+
#
6+
# Common tasks
7+
#
8+
# - Run on all files: pre-commit run --all-files
9+
# - Register git hooks: pre-commit install --install-hooks
10+
#
111
repos:
2-
- repo: https://github.com/google/go-jsonnet
3-
rev: v0.20.0
4-
hooks:
5-
- id: jsonnet-format
6-
# jsonnet-lint hook doesn't work
7-
# - id: jsonnet-lint
12+
- repo: https://github.com/google/go-jsonnet
13+
rev: v0.20.0
14+
hooks:
15+
- id: jsonnet-format
16+
# jsonnet-lint hook doesn't work
17+
# - id: jsonnet-lint
18+
19+
- repo: https://github.com/astral-sh/ruff-pre-commit
20+
rev: v0.3.4
21+
hooks:
22+
- id: ruff-format
23+
- id: ruff
24+
args:
25+
- --fix
26+
27+
# pre-commit.ci config reference: https://pre-commit.ci/#configuration
28+
ci:
29+
autoupdate_schedule: monthly

pyproject.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# ruff is used for autoformatting and linting Python code
2+
#
3+
# ref: https://docs.astral.sh/ruff/configuration/
4+
#
5+
[tool.ruff]
6+
target-version = "py38"
7+
8+
# ruff formatter ref: https://docs.astral.sh/ruff/formatter/
9+
[tool.ruff.format]
10+
quote-style = "preserve"
11+
12+
# ruff linter ref: https://docs.astral.sh/ruff/linter/
13+
[tool.ruff.lint]
14+
ignore = []
15+
select = [
16+
"E9", # syntax
17+
"I", # isort
18+
"UP", # pyupgrade
19+
"F", # flake8
20+
]

0 commit comments

Comments
 (0)