Skip to content

Commit 55903f3

Browse files
authored
chore: 🔨 add commit linting via pre-commit (#16)
## Description This PR adds pre-commit to the repos, which will auto-run commit linting before the commit message is finished. After this is merged in and sync'ed with Sprout, the spaid command `spaid_setup_dev_workspace` will install everything for this to start working. Alternatively, this pre-commit will always run on PRs, and will throw an error if a commit message is wrong. Closes #8, closes seedcase-project/team#89 <!-- Select quick/in-depth as necessary --> This PR needs an in-depth review.
2 parents 4d97e7c + 6e632c5 commit 55903f3

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

.github/sync.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ group:
33
# General
44
- source: .github/CODEOWNERS
55
dest: .github/CODEOWNERS
6+
- source: .pre-commit-config.yaml
7+
dest: .pre-commit-config.yaml
68
- source: .dockerignore
79
dest: .dockerignore
810
- source: .editorconfig

.pre-commit-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
ci:
4+
autofix_commit_msg: "chore(pre-commit): :pencil2: automatic fixes"
5+
autoupdate_commit_msg: "ci(pre-commit): :construction_worker: update pre-commit CI version"
6+
7+
repos:
8+
- repo: https://github.com/pre-commit/pre-commit-hooks
9+
rev: v5.0.0
10+
hooks:
11+
- id: trailing-whitespace
12+
- id: end-of-file-fixer
13+
14+
- repo: https://github.com/commitizen-tools/commitizen
15+
rev: v3.30.0
16+
hooks:
17+
- id: commitizen

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ poetry init
1919
Search for `NAME` and `REPO` and replace them with the name of your project and the repository name. Then look for any `TODO` items.
2020

2121
You will need to set up Fly manually for now.
22+
23+
## Setting things up
24+
25+
Use the commands found in [`spaid`](https://github.com/seedcase-project/spaid) repo to run the next setup steps.

justfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ build-website:
6060
export QUARTO_PYTHON=.venv/bin/python3
6161
poetry run quarto render --execute
6262

63-
# Add files for a new function (function file and test file)
64-
add-function app part name:
65-
touch ./{{app}}/{{part}}/{{name}}.py
66-
touch ./tests/{{part}}/test_{{name}}.py
63+
check-commit:
64+
#!/bin/zsh
65+
if [[ $(git rev-parse --abbrev-ref HEAD) != "main" ]]
66+
then
67+
poetry run cz check --rev-range main..HEAD
68+
fi

0 commit comments

Comments
 (0)