Skip to content

Commit d0c50e5

Browse files
committed
chore: Add pre-commit config
1 parent 392355b commit d0c50e5

File tree

3 files changed

+79
-3
lines changed

3 files changed

+79
-3
lines changed

.pre-commit-config.yaml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.3.0
4+
hooks:
5+
- id: end-of-file-fixer
6+
- id: check-added-large-files
7+
- id: check-merge-conflict
8+
- id: check-docstring-first
9+
- id: debug-statements
10+
- repo: https://github.com/PyCQA/flake8
11+
rev: 5.0.4
12+
hooks:
13+
- id: flake8
14+
args: ["--config=.flake8"]
15+
additional_dependencies:
16+
- flake8-builtins
17+
- flake8-annotations
18+
- flake8-commas
19+
- flake8-isort
20+
- flake8-print
21+
- flake8-debugger
22+
- repo: https://github.com/pycqa/isort
23+
rev: 5.10.1
24+
hooks:
25+
- id: isort
26+
- repo: https://github.com/asottile/pyupgrade
27+
rev: v2.37.3
28+
hooks:
29+
- id: pyupgrade
30+
args: ["--py37-plus"]
31+
- repo: https://github.com/asottile/add-trailing-comma
32+
rev: v2.2.3
33+
hooks:
34+
- id: add-trailing-comma
35+
args: ["--py36-plus"]
36+
- repo: https://github.com/Lucas-C/pre-commit-hooks-safety
37+
rev: v1.3.0
38+
hooks:
39+
- id: python-safety-dependencies-check
40+
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
41+
rev: v9.1.0
42+
hooks:
43+
- id: commitlint
44+
stages: [commit-msg]
45+
additional_dependencies:
46+
- "@commitlint/config-conventional"
47+
default_stages:
48+
- commit
49+
default_install_hook_types:
50+
- pre-commit
51+
- commit-msg

build/Taskfile

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
#!/usr/bin/env bash
22
# b5 Taskfile, see https://git.team23.de/build/b5 for details
33

4+
pre-commit:install() {
5+
if ( which pre-commit > /dev/null 2>&1 )
6+
then
7+
pre-commit install --install-hooks
8+
else
9+
b5:warn "-----------------------------------------------------------------"
10+
b5:warn "pre-commit is not installed - cannot enable pre-commit hooks!"
11+
b5:warn "Recommendation: Install pre-commit ('brew install pre-commit')."
12+
b5:warn "-----------------------------------------------------------------"
13+
fi
14+
}
15+
416
task:install() {
5-
cd .. && \
6-
poetry install
17+
task:poetry install
18+
19+
pre-commit:install
720
}
821

922
task:update() {
10-
task:install
23+
task:poetry install
1124
}
1225

1326
task:poetry() {

commitlint.config.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
// See https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/config-conventional/index.js
3+
extends: ['@commitlint/config-conventional'],
4+
// Own rules
5+
rules: {
6+
'subject-case': [
7+
2,
8+
'never',
9+
['start-case', 'pascal-case', 'upper-case'],
10+
],
11+
},
12+
}

0 commit comments

Comments
 (0)