Skip to content

Commit 51617a5

Browse files
authored
Merge pull request #56 from qurator-spk/pre-commit
⚙ Add pre-commit config + docs
2 parents 76b36cb + ed0da44 commit 51617a5

File tree

4 files changed

+85
-0
lines changed

4 files changed

+85
-0
lines changed

.pre-commit-config.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-json
8+
- id: check-toml
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- id: check-ast
12+
13+
- repo: https://github.com/psf/black
14+
rev: 25.1.0
15+
hooks:
16+
- id: black
17+
18+
- repo: https://github.com/astral-sh/ruff-pre-commit
19+
rev: v0.11.13
20+
hooks:
21+
- args:
22+
- --fix
23+
- --exit-non-zero-on-fix
24+
id: ruff-check
25+
26+
- repo: https://gitlab.com/vojko.pribudic.foss/pre-commit-update
27+
rev: v0.7.0
28+
hooks:
29+
- id: pre-commit-update
30+
31+
- repo: https://github.com/dhatim/python-license-check
32+
rev: 0.9.3
33+
hooks:
34+
- id: liccheck
35+
language: system

README-DEV.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,10 @@ To run a test with profiling:
1515
```
1616
pytest --profile-svg -k test_page_info
1717
```
18+
19+
# How to use pre-commit
20+
21+
This project optionally uses [pre-commit](https://pre-commit.com) to check commits. To use it:
22+
23+
- Install pre-commit, e.g. `pip install -r requirements-dev.txt`
24+
- Install the repo-local git hooks: `pre-commit install`

pyproject.toml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,42 @@ optional-dependencies.dev = {file = ["requirements-dev.txt"]}
4444

4545
[tool.setuptools.packages.find]
4646
where = ["src"]
47+
48+
49+
[tool.ruff.lint]
50+
select = ["E", "F", "I"]
51+
52+
53+
[tool.liccheck]
54+
authorized_licenses = [
55+
"bsd",
56+
"new bsd",
57+
"bsd license",
58+
"new bsd license",
59+
"simplified bsd",
60+
"apache",
61+
"apache 2.0",
62+
"apache software license",
63+
"apache software",
64+
"apache license 2.0",
65+
"gnu lgpl",
66+
"lgpl with exceptions or zpl",
67+
"GNU Library or Lesser General Public License (LGPL)",
68+
"GNU Lesser General Public License v3 (LGPLv3)",
69+
"GNU Lesser General Public License v2 or later (LGPLv2+)",
70+
"mit",
71+
"mit license",
72+
"mit-cmu",
73+
"python software foundation",
74+
"psf",
75+
"psf-2.0",
76+
"Historical Permission Notice and Disclaimer (HPND)",
77+
"public domain",
78+
'The Unlicense (Unlicense)',
79+
"isc",
80+
"ISC License (ISCL)",
81+
'Mozilla Public License 2.0 (MPL 2.0)',
82+
]
83+
unauthorized_licenses = [
84+
"gpl v3",
85+
]

requirements-dev.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ mypy
77
types-lxml
88
types-tqdm
99
pandas-stubs
10+
11+
pre-commit
12+
setuptools
13+
liccheck

0 commit comments

Comments
 (0)