Skip to content

Commit 6628f38

Browse files
authored
Merge pull request #14 from stefanofusai/feat-implement-more-pre-commit-hooks
2 parents a61c72b + 6b333c2 commit 6628f38

File tree

5 files changed

+59
-48
lines changed

5 files changed

+59
-48
lines changed

.github/dependabot.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ updates:
55
schedule:
66
interval: daily
77
target-branch: main
8-
98
- package-ecosystem: pip
109
directory: /
1110
schedule:
1211
interval: daily
13-
target-branch: main
12+
target-branch: main

.github/workflows/workflow.yml

-30
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,35 @@
11
name: CI/CD Pipeline
2-
32
on:
43
push:
54
pull_request:
65
release:
76
types:
87
- published
9-
108
permissions:
119
contents: read
12-
1310
jobs:
14-
run-linter:
15-
runs-on: ubuntu-latest
16-
17-
strategy:
18-
matrix:
19-
python-version:
20-
- 3.11
21-
- 3.12
22-
23-
steps:
24-
- name: Checkout repository
25-
uses: actions/checkout@v4
26-
27-
- name: Run linter on Python ${{ matrix.python-version }}
28-
uses: chartboost/ruff-action@v1
29-
with:
30-
version: 0.6.5
31-
3211
publish-to-pypi:
33-
needs: run-linter
3412
if: github.event_name == 'release' && github.event.action == 'published'
3513
runs-on: ubuntu-latest
36-
3714
environment: release
38-
3915
permissions:
4016
id-token: write
41-
4217
strategy:
4318
matrix:
4419
python-version:
4520
- 3.12
46-
4721
steps:
4822
- name: Checkout repository
4923
uses: actions/checkout@v4
50-
5124
- name: Set up Python ${{ matrix.python-version }}
5225
uses: actions/setup-python@v5
5326
with:
5427
python-version: ${{ matrix.python-version }}
55-
5628
- name: Install dependencies
5729
run: |
5830
python -m pip install --upgrade pip
5931
pip install build
60-
6132
- name: Build package
6233
run: python -m build
63-
6434
- name: Publish package
6535
uses: pypa/gh-action-pypi-publish@release/v1.8

.pre-commit-config.yaml

+54-14
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,77 @@
11
ci:
22
skip:
33
- pip-compile
4-
54
default_language_version:
65
python: python3.12
7-
86
repos:
7+
# Generic file checks and fixes
98
- repo: https://github.com/pre-commit/pre-commit-hooks
109
rev: v4.6.0
1110
hooks:
12-
- id: check-toml
13-
- id: check-yaml
11+
- id: end-of-file-fixer
1412
- id: file-contents-sorter
1513
files: ^requirements\.in$
16-
17-
- repo: https://github.com/astral-sh/uv-pre-commit
18-
rev: 0.4.10
14+
# Specific checks and fixes for different file types
15+
- repo: https://github.com/markdownlint/markdownlint
16+
rev: 41fc308f0d7f2647f0ae2c2d3826f48e42d964f4
1917
hooks:
20-
- id: pip-compile
18+
- id: markdownlint
2119
args:
22-
- requirements.in
23-
- -o
24-
- requirements.txt
25-
20+
- -r
21+
- ~MD013
22+
- repo: https://github.com/pre-commit/pre-commit-hooks
23+
rev: v4.6.0
24+
hooks:
25+
- id: check-toml
26+
- repo: https://github.com/adrienverge/yamllint
27+
rev: f0c0c7586b97809289bdcfe83a66363330b645d8
28+
hooks:
29+
- id: yamllint
30+
args:
31+
- -d
32+
- "{extends: default, rules: {comments: {min-spaces-from-content: 1}, document-start: {present: false}, line-length: disable}}"
33+
- repo: https://github.com/google/yamlfmt
34+
rev: v0.13.0
35+
hooks:
36+
- id: yamlfmt
37+
args:
38+
- -formatter
39+
- eof_newline=true
40+
# Specific checks and fixes for Python files
2641
- repo: https://github.com/asottile/pyupgrade
2742
rev: v3.17.0
2843
hooks:
2944
- id: pyupgrade
30-
3145
- repo: https://github.com/astral-sh/ruff-pre-commit
3246
rev: v0.6.5
3347
hooks:
3448
- id: ruff
3549
args:
3650
- --fix
37-
- id: ruff-format
51+
- id: ruff-format
52+
# Specific checks and fixes for Git
53+
- repo: https://github.com/jorisroovers/gitlint
54+
rev: v0.19.1
55+
hooks:
56+
- id: gitlint
57+
args:
58+
- -c
59+
- title-match-regex.regex=^(Build|Bump|Chore|Ci|Docs|Feat|Fix|Perf|Refactor|Revert|Style|Test):\s[a-z].*$
60+
- --ignore=B6
61+
- --msg-filename
62+
- repo: https://github.com/pre-commit/pre-commit-hooks
63+
rev: v4.6.0
64+
hooks:
65+
- id: no-commit-to-branch
66+
args:
67+
- --branch
68+
- main
69+
# Dependency management
70+
- repo: https://github.com/astral-sh/uv-pre-commit
71+
rev: 0.4.10
72+
hooks:
73+
- id: pip-compile
74+
args:
75+
- requirements.in
76+
- -o
77+
- requirements.txt

CONTRIBUTING.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
12
# Contributing
2-
This project welcomes contributions from the community. Contributions are accepted using GitHub pull requests.
3+
4+
This project welcomes contributions from the community. Contributions are accepted using GitHub pull requests.

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
55

66
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
77

8-
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)