chore: switch to pre-commit

This commit is contained in:
Daylin Morgan 2023-01-07 10:12:48 -06:00
parent 70f6cf9fc9
commit 916e85c67c
3 changed files with 36 additions and 2 deletions

24
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,24 @@
exclude: "^(src/.*|bin/font-patcher)"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pycqa/isort
rev: 5.9.3
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.2
hooks:
- id: shellcheck

View file

@ -29,10 +29,10 @@ update-src:
$(call msg,Updating Source Files) $(call msg,Updating Source Files)
@./bin/update-src @./bin/update-src
## lint | check shell scripts ## lint | run pre-commit hooks
.PHONY: lint .PHONY: lint
lint: lint:
@shfmt -w -s $(shell shfmt -f bin/) @pre-commit run --all
## clean | remove patched fonts ## clean | remove patched fonts
.PHONY: clean .PHONY: clean

View file

@ -80,6 +80,16 @@ You can verify the fonts have been added with `make check`.
If I haven't committed to this repo in a while it's likely a good idea to run `make update-src` to update the fonts, icons and patcher script from nerd fonts. If I haven't committed to this repo in a while it's likely a good idea to run `make update-src` to update the fonts, icons and patcher script from nerd fonts.
## Contributing
Before making changes to to any of the scripts in `bin` you should first install `pre-commit`.
Followed by setting up the `pre-commit` hooks locally.
```bash
pipx install pre-commit
pre-commit install
```
## Special Thanks ## Special Thanks
- [MonoLisa](https://www.monolisa.dev) - [MonoLisa](https://www.monolisa.dev)