File tree Expand file tree Collapse file tree 4 files changed +46
-50
lines changed
Expand file tree Collapse file tree 4 files changed +46
-50
lines changed Original file line number Diff line number Diff line change @@ -57,24 +57,25 @@ follow the Conventional Commit standard. This will only work if:
5757Otherwise, you’ll get an error or nothing will happen.
5858
5959``` bash
60- spaid_setup_dev_workspace -h
60+ spaid_setup_precommit -h
6161```
6262
63- Usage: spaid_setup_dev_workspace \[ -h\]
63+ Usage: spaid_setup_precommit \[ -h\]
6464
65- Run this command to either setup up or update your development workspace
66- to have any helper packages or tools installed and configured. These are
67- the actions it does currently:
65+ Run this command to setup pre-commit on the repository. It will:
6866
69- - Installs Python package dependencies (if in a Poetry project)
70- - Installs pre-commit hooks
71- - Runs pre-commit hooks on all the files
67+ - Install pre-commit hooks
68+ - Do an initial run of the pre-commit hooks on all the files
7269
7370This command only works if:
7471
7572- you are in a local Git repository
7673- the repository has a file called ‘.pre-commit-config.yaml’
7774
75+ Examples:
76+
77+ spaid_setup_precommit
78+
7879``` bash
7980spaid_create_python_files -h
8081```
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ spaid_lint_commits_on_branch -h
4848
4949``` {bash}
5050#| output: asis
51- spaid_setup_dev_workspace -h
51+ spaid_setup_precommit -h
5252```
5353
5454``` {bash}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #! /bin/zsh
2+
3+ help_text="
4+ Usage: ` basename $0 ` [-h]
5+
6+ Run this command to setup pre-commit on the repository. It will:
7+
8+ - Install pre-commit hooks
9+ - Do an initial run of the pre-commit hooks on all the files
10+
11+ This command only works if:
12+
13+ - you are in a local Git repository
14+ - the repository has a file called '.pre-commit-config.yaml'
15+
16+ Examples:
17+
18+ spaid_setup_precommit
19+ "
20+
21+ if [[ " $1 " == " -h" ]] ; then
22+ echo $help_text
23+ exit 0
24+ fi
25+
26+ precommit_file=$( pwd) /.pre-commit-config.yaml
27+
28+ if [[ ! -f " $precommit_file " ]]
29+ then
30+ echo " Error: No '$precommit_file ' found. You need to create one to continue."
31+ exit 1
32+ fi
33+
34+ # Install pre-commit hooks as defined in `.pre-commit-config.yaml`
35+ uvx pre-commit install
36+ uvx pre-commit run --all-files
You can’t perform that action at this time.
0 commit comments