diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..ea60776 --- /dev/null +++ b/.pre-commit-config.yaml @@ -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 diff --git a/Makefile b/Makefile index 8c4c6ec..0015b39 100644 --- a/Makefile +++ b/Makefile @@ -29,10 +29,10 @@ update-src: $(call msg,Updating Source Files) @./bin/update-src -## lint | check shell scripts +## lint | run pre-commit hooks .PHONY: lint lint: - @shfmt -w -s $(shell shfmt -f bin/) + @pre-commit run --all ## clean | remove patched fonts .PHONY: clean diff --git a/README.md b/README.md index 6a4eb2d..9843e9a 100644 --- a/README.md +++ b/README.md @@ -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. +## 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 - [MonoLisa](https://www.monolisa.dev)