Skip to content

Commit f2d0b4c

Browse files
committed
Add pre-commit tool and with some configs
1 parent 7ae67c7 commit f2d0b4c

File tree

3 files changed

+98
-0
lines changed

3 files changed

+98
-0
lines changed

.pre-commit-config.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
repos:
3+
- repo: "https://github.com/pre-commit/pre-commit-hooks"
4+
rev: "v4.5.0"
5+
hooks:
6+
- id: "trailing-whitespace"
7+
exclude: "^pulp_docs"
8+
- id: "end-of-file-fixer"
9+
exclude: "^pulp_docs"
10+
- id: "check-added-large-files"
11+
- id: "check-toml"
12+
13+
- repo: "https://github.com/astral-sh/ruff-pre-commit"
14+
rev: "v0.11.10"
15+
hooks:
16+
# Run the linter.
17+
- id: "ruff-check"
18+
args: [ "--fix" ]
19+
# Run the formatter.
20+
- id: "ruff-format"
21+
22+
- repo: "https://github.com/adrienverge/yamllint"
23+
rev: "v1.35.1"
24+
hooks:
25+
- id: "yamllint"
26+
files: ".*y[a]ml$"
27+
28+
- repo: "https://github.com/crate-ci/typos"
29+
rev: "v1.19.0"
30+
hooks:
31+
- id: "typos"
32+
exclude: "(^tests)|(^docs)|(^pulp_docs)"
33+
...

.yamllint.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
3+
yaml-files:
4+
- '*.yaml'
5+
- '*.yml'
6+
- '.yamllint'
7+
8+
rules: # defaults are commented out
9+
# anchors: enable
10+
# braces: enable
11+
# brackets: enable
12+
# colons: enable
13+
# commas: enable
14+
# comments:
15+
# level: warning
16+
# comments-indentation:
17+
# level: warning
18+
document-end: enable
19+
document-start: enable
20+
# level: warning
21+
# empty-lines: enable
22+
# empty-values: disable
23+
# float-values: disable
24+
# hyphens: enable
25+
# indentation: enable
26+
# key-duplicates: enable
27+
# key-ordering: disable
28+
# line-length: enable
29+
# new-line-at-end-of-file: enable
30+
# new-lines: enable
31+
# octal-values: disable
32+
# https://yamllint.readthedocs.io/en/stable/rules.html#module-yamllint.rules.quoted_strings
33+
quoted-strings:
34+
quote-type: double
35+
required: true
36+
allow-quoted-quotes: true
37+
check-keys: false
38+
39+
# trailing-spaces: enable
40+
# truthy:
41+
# level: warning
42+
...

pyproject.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dependencies = [
1717
"httpx",
1818
"rich",
1919
"GitPython~=3.1.44",
20+
"pre-commit~=3.6.2",
2021
]
2122

2223
[project.scripts]
@@ -39,3 +40,25 @@ pythonpath = "src"
3940
addopts = [
4041
"--import-mode=importlib",
4142
]
43+
44+
[tool.ruff]
45+
line-length = 100
46+
target-version = "py312"
47+
48+
[tool.ruff.lint]
49+
select = ["E", "F", "I"]
50+
ignore = []
51+
exclude = [
52+
".git",
53+
".ruff_cache",
54+
"__pycache__",
55+
"build",
56+
"dist",
57+
"venv",
58+
".venv",
59+
]
60+
61+
[tool.ruff.format]
62+
quote-style = "double"
63+
indent-style = "space"
64+
line-ending = "auto"

0 commit comments

Comments
 (0)