Skip to content

Commit c474e4c

Browse files
committed
Add pre-commit
1 parent 8ebd589 commit c474e4c

File tree

7 files changed

+80
-10
lines changed

7 files changed

+80
-10
lines changed

.github/workflows/main.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,26 @@ concurrency:
1414

1515
jobs:
1616

17+
'pre-commit':
18+
19+
runs-on: 'ubuntu-24.04'
20+
21+
steps:
22+
23+
- name: "Setup Python"
24+
uses: 'actions/setup-python@v5'
25+
with:
26+
python-version: '3.10'
27+
28+
- name: "Install pre-commit"
29+
run: 'python -m pip install pre-commit'
30+
31+
- name: "Checkout"
32+
uses: 'actions/checkout@v4'
33+
34+
- name: "Check with pre-commit"
35+
run: 'pre-commit run --all-files --show-diff-on-failure'
36+
1737
'build-job':
1838

1939
runs-on: 'ubuntu-24.04'

.gitlab-ci.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
---
22

33

4-
'.common':
4+
'pre-commit':
5+
image: 'python:3.10'
6+
before_script:
7+
- 'python -m pip install pre-commit'
8+
script:
9+
- 'pre-commit run --all-files --show-diff-on-failure'
10+
11+
'.build':
512
image: 'python:3.10'
613
before_script:
714
- 'apt-get --assume-yes --quiet update'
@@ -18,10 +25,10 @@
1825
- 'cp -r build/html public'
1926

2027
'build':
21-
extends: '.common'
28+
extends: '.build'
2229

2330
pages:
24-
extends: '.common'
31+
extends: '.build'
2532
artifacts:
2633
paths:
2734
- 'public'

.pre-commit-config.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
3+
4+
repos:
5+
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v5.0.0
8+
hooks:
9+
- id: check-added-large-files
10+
- id: check-ast
11+
- id: check-builtin-literals
12+
- id: check-case-conflict
13+
- id: check-docstring-first
14+
- id: check-executables-have-shebangs
15+
- id: check-illegal-windows-names
16+
- id: check-json
17+
- id: check-merge-conflict
18+
- id: check-shebang-scripts-are-executable
19+
- id: check-symlinks
20+
- id: check-toml
21+
- id: check-vcs-permalinks
22+
- id: check-xml
23+
- id: check-yaml
24+
- id: debug-statements
25+
- id: destroyed-symlinks
26+
# - id: detect-aws-credentials
27+
- id: detect-private-key
28+
- id: double-quote-string-fixer
29+
- id: end-of-file-fixer
30+
- id: file-contents-sorter
31+
- id: fix-byte-order-marker
32+
- id: forbid-new-submodules
33+
- id: forbid-submodules
34+
- id: mixed-line-ending
35+
- id: name-tests-test
36+
# - id: no-commit-to-branch
37+
- id: pretty-format-json
38+
- id: requirements-txt-fixer
39+
- id: sort-simple-yaml
40+
- id: trailing-whitespace
41+
42+
43+
... # EOF

conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
AUTHOR = 'sinoroc'
66
MASTER_DOCUMENT = 'contents'
7-
SUBTITLE = "Bits of knowledge"
8-
TITLE = "Sinoroc KB"
7+
SUBTITLE = 'Bits of knowledge'
8+
TITLE = 'Sinoroc KB'
99

1010

11-
#
11+
#
1212
# General
1313
#
1414

src/python/package_data.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ In ``setup.py``:
7171
:emphasize-lines: 6-8
7272
7373
#!/usr/bin/env python3
74-
74+
7575
import setuptools
76-
76+
7777
setuptools.setup(
7878
exclude_package_data={'thing': ['data/*.src']},
7979
include_package_data=True,

src/python/python_imports.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Python imports
4545
* Old reference, possibly outdated, but assuming I interpreted it right, it
4646
says that running *scripts* that live in a package is an anti pattern, and
4747
one should use ``python -m package.module`` instead:
48-
48+
4949
* https://mail.python.org/pipermail/python-3000/2007-April/006793.html
5050
* https://www.python.org/dev/peps/pep-3122/
5151

src/python/tox.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Defaults
2929

3030
.. code-block:: ini
3131
:caption: tox.ini
32-
32+
3333
[tox]
3434
envlist =
3535
py37

0 commit comments

Comments
 (0)