Merge pull request #22 from wi11-holdsworth/enhancement/12
refactor: replace manual pre-commit with a declarative, installable pre-commit hook via pre-commit.com
This commit is contained in:
commit
592f72346a
4 changed files with 28 additions and 22 deletions
11
.pre-commit
11
.pre-commit
|
|
@ -1,11 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g')
|
|
||||||
[ -z "$FILES" ] && exit 0
|
|
||||||
|
|
||||||
# Prettify all selected files
|
|
||||||
echo "$FILES" | xargs keep-sorted
|
|
||||||
|
|
||||||
# Add back the modified files to staging
|
|
||||||
echo "$FILES" | xargs git add
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
27
.pre-commit-config.yaml
Normal file
27
.pre-commit-config.yaml
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
# See https://pre-commit.com for more information
|
||||||
|
# See https://pre-commit.com/hooks.html for more hooks
|
||||||
|
#
|
||||||
|
# Install pre-commit itself:
|
||||||
|
# $ pip install pre-commit
|
||||||
|
# OR
|
||||||
|
# $ brew install pre-commit
|
||||||
|
#
|
||||||
|
# Update all pre-commit hooks to latest version:
|
||||||
|
# $ pre-commit autoupdate
|
||||||
|
#
|
||||||
|
# Install all default pre-commit hooks locally:
|
||||||
|
# $ pre-commit install
|
||||||
|
#
|
||||||
|
# Apply a given pre-commit hook to all files:
|
||||||
|
# $ pre-commit run --all-files <id>
|
||||||
|
#
|
||||||
|
# Apply all pre-commit hooks to all files:
|
||||||
|
# $ pre-commit run --all-files
|
||||||
|
ci:
|
||||||
|
autoupdate_schedule: monthly
|
||||||
|
submodules: true
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/google/keep-sorted
|
||||||
|
rev: c71803fd297b5736f3bfab1cfd84424ca52e961a # frozen: v0.7.1
|
||||||
|
hooks:
|
||||||
|
- id: keep-sorted
|
||||||
11
README.md
11
README.md
|
|
@ -1,11 +0,0 @@
|
||||||
# dots
|
|
||||||
## build
|
|
||||||
### `keep-sorted` pre-commit hook
|
|
||||||
copy the pre-commit hook to `.git/hooks`
|
|
||||||
```bash
|
|
||||||
cp .pre-commit .git/hooks/pre-commit
|
|
||||||
```
|
|
||||||
make it executable
|
|
||||||
```bash
|
|
||||||
chmod +x .git/hooks/pre-commit
|
|
||||||
```
|
|
||||||
|
|
@ -57,6 +57,7 @@ in
|
||||||
pastel # colour generation
|
pastel # colour generation
|
||||||
pdd # datetime calculations
|
pdd # datetime calculations
|
||||||
pirate-get # torrenting
|
pirate-get # torrenting
|
||||||
|
pre-commit # declarative pre-commit installer and runner
|
||||||
procs # ps
|
procs # ps
|
||||||
rates # currency conversion
|
rates # currency conversion
|
||||||
ripgrep-all # grep
|
ripgrep-all # grep
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue