From dfbfb2057d5af9819071d18685eb24cce05cd647 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Wed, 30 Oct 2024 11:11:36 -0400 Subject: [PATCH 1/5] chore: :hammer: add pre-commit hooks, including for commit linting Closes #8, closes seedcase-project/team#89 --- .pre-commit-config.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..8eac979 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +ci: + autofix_commit_msg: "chore(pre-commit): :pencil2: automatic fixes" + autoupdate_commit_msg: "ci(pre-commit): :construction_worker: update pre-commit CI version" + +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + +- repo: https://github.com/commitizen-tools/commitizen + rev: v1.17.0 + hooks: + - id: commitizen From b9d287c38f65b14fc2f5561bceeac0208446b347 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Wed, 30 Oct 2024 11:12:22 -0400 Subject: [PATCH 2/5] build: :hammer: add justfile recipe to lint commits --- justfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/justfile b/justfile index c026acf..f6733e1 100644 --- a/justfile +++ b/justfile @@ -60,7 +60,9 @@ build-website: export QUARTO_PYTHON=.venv/bin/python3 poetry run quarto render --execute -# Add files for a new function (function file and test file) -add-function app part name: - touch ./{{app}}/{{part}}/{{name}}.py - touch ./tests/{{part}}/test_{{name}}.py +check-commit: + #!/bin/zsh + if [[ $(git rev-parse --abbrev-ref HEAD) != "main" ]] + then + poetry run cz check --rev-range main..HEAD + fi From 7ef1a9141f990ad82041ae6e56c9d3208de855a8 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Wed, 30 Oct 2024 11:12:43 -0400 Subject: [PATCH 3/5] docs: :memo: refer to spaid for setting things up --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index b7a3018..d07ae2e 100644 --- a/README.md +++ b/README.md @@ -19,3 +19,7 @@ poetry init Search for `NAME` and `REPO` and replace them with the name of your project and the repository name. Then look for any `TODO` items. You will need to set up Fly manually for now. + +## Setting things up + +Use the commands found in [`spaid`](https://github.com/seedcase-project/spaid) repo to run the next setup steps. From 726a2ba8430a4d6e886c05eb24897fa9a090da84 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Wed, 30 Oct 2024 11:15:38 -0400 Subject: [PATCH 4/5] ci: :construction_worker: add pre-commit config file to be synched --- .github/sync.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/sync.yml b/.github/sync.yml index 100076b..18fbad9 100644 --- a/.github/sync.yml +++ b/.github/sync.yml @@ -3,6 +3,8 @@ group: # General - source: .github/CODEOWNERS dest: .github/CODEOWNERS + - source: .pre-commit-config.yaml + dest: .pre-commit-config.yaml - source: .dockerignore dest: .dockerignore - source: .editorconfig From 6e632c5bad877fea14463a14cb7a0f7fe4c2a169 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Wed, 30 Oct 2024 11:39:21 -0400 Subject: [PATCH 5/5] chore: :pushpin: update versions for pre-commit hooks --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8eac979..c9fd11a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,12 +6,12 @@ ci: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 + rev: v5.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - repo: https://github.com/commitizen-tools/commitizen - rev: v1.17.0 + rev: v3.30.0 hooks: - id: commitizen