Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ install: $(if $(value CI),,install-hooks)

## run hooks on default snapshot
test: snapshots
cd snapshots/default && git init && git add . && make hooks
cd snapshots/default && git init && make hooks

## make the snapshots
snapshots: $(shell find {{cookiecutter.repo_name}}) snapshots/*.yaml
Expand Down
69 changes: 69 additions & 0 deletions snapshots/default/.lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Refer for explanation to following link:
# https://lefthook.dev/configuration/
#

# output:
# # - meta # Print lefthook version
# - summary # Print summary block (successful and failed steps)
# - empty_summary # Print summary heading when there are no steps to run
# # - success # Print successful steps
# - failure # Print failed steps printing
# # - execution # Print any execution logs
# # - execution_out # Print execution output
# # - execution_info # Print `EXECUTE > ...` logging
# - skips # Print "skip" (i.e. no files matched)

pre-push:
# parallel: true
jobs:
# - name: typos
# run: typos

- name: echo
#glob: "*.md"
run: ./echo.sh {all_files}


- name: ruff
run: uv run ruff check --force-exclude {push_files}
tags:
- check

- name: ruff-format
glob: "*.py"
run: uv run ruff format {push_files}

tags:
- check

- name: pyright
run: uv run pyright
tags:
- check

- name: test
run: uv run pytest
#
# pre-commit:
# parallel: true
# jobs:
# - run: yarn eslint {staged_files}
# glob: "*.{js,ts,jsx,tsx}"
#
# - name: rubocop
# glob: "*.rb"
# exclude:
# - config/application.rb
# - config/routes.rb
# run: bundle exec rubocop --force-exclusion {all_files}
#
# - name: govet
# files: git ls-files -m
# glob: "*.go"
# run: go vet {files}
#
# - script: "hello.js"
# runner: node
#
# - script: "hello.go"
# runner: go run
4 changes: 2 additions & 2 deletions snapshots/default/Makefile-common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ publish:

## run pre-commit git hooks on all files
hooks:
uv run pre-commit run --color=always --all-files --hook-stage pre-push
uv run lefthook run pre-push --all-files --force

install-hooks: .git/hooks/pre-push

.git/hooks/pre-push:
uv run pre-commit install --install-hooks -t pre-push
uv run lefthook install
5 changes: 5 additions & 0 deletions snapshots/default/echo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash


echo "Hello, World!"
echo "$@"
2 changes: 1 addition & 1 deletion snapshots/default/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies = []
[dependency-groups]
dev = [
"build~=1.0",
"pre-commit~=4.0",
"lefthook~=1.11",
"pyright==1.1.409",
"pytest~=9.0",
"ruff~=0.15.4",
Expand Down
47 changes: 47 additions & 0 deletions {{cookiecutter.repo_name}}/.lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Refer for explanation to following link:
# https://lefthook.dev/configuration/
#

output:
# - meta # Print lefthook version
- summary # Print summary block (successful and failed steps)
- empty_summary # Print summary heading when there are no steps to run
# - success # Print successful steps
- failure # Print failed steps printing
# - execution # Print any execution logs
# - execution_out # Print execution output
# - execution_info # Print `EXECUTE > ...` logging
- skips # Print "skip" (i.e. no files matched)

# pre-commit:
# # parallel: true
# jobs:
# # - name: typos
# # run: typos

# - name: echo
# glob: "*.env"
# run: ./echo.sh {staged_files}

pre-push:
jobs:
# - name: typos
# run: typos

- name: ruff
glob: "*.py"
run: uv run ruff check --force-exclude {push_files}

- name: ruff-format
glob: "*.py"
run: uv run ruff format {push_files}

- name: pyright and test
group:
parallel: true
jobs:
- name: pyright
run: uv run pyright

- name: test
run: uv run pytest
4 changes: 2 additions & 2 deletions {{cookiecutter.repo_name}}/Makefile-common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ publish:

## run pre-commit git hooks on all files
hooks:
uv run pre-commit run --color=always --all-files --hook-stage pre-push
uv run lefthook run pre-push --all-files --force

install-hooks: .git/hooks/pre-push

.git/hooks/pre-push:
uv run pre-commit install --install-hooks -t pre-push
uv run lefthook install
2 changes: 1 addition & 1 deletion {{cookiecutter.repo_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies = []
[dependency-groups]
dev = [
"build~=1.0",
"pre-commit~=4.0",
"lefthook~=1.11",
"pyright==1.1.409",
"pytest~=9.0",
"ruff~=0.15.4",
Expand Down
Loading