diff options
author | Okke Formsma <okke@formsma.nl> | 2020-11-14 20:38:48 +0100 |
---|---|---|
committer | Pete Johanson <peter@peterjohanson.com> | 2021-02-04 07:42:02 -0500 |
commit | 11d990e59a55bf1e834c12cae4542e1ab6af4f20 (patch) | |
tree | 450b7014cb11b0f7bb95c08a7dcfcde95d90ab41 | |
parent | b84d29c384532443010a7140e8670482f2a6ca02 (diff) |
setup pre-commit hooks for clang-format and prettier
-rw-r--r-- | .pre-commit-config.yaml | 12 | ||||
-rw-r--r-- | CONTRIBUTING.md | 7 |
2 files changed, 19 insertions, 0 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..5974bd6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,12 @@ +fail_fast: false +repos: + - repo: https://github.com/pocc/pre-commit-hooks + rev: master + hooks: + - id: clang-format + args: + - -i + - repo: https://github.com/prettier/prettier + rev: master + hooks: + - id: prettier diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3ea8c78..2783c17 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -81,6 +81,11 @@ documentation to areas not currently covered are greatly appreciated. - To get started, from the `docs/` directory, run `npm ci` and then `npm start`. - Enhancements should be submitted as pull requests to the `main` branch of ZMK. +### Formatting + +ZMK uses `prettier` to format documentation files. You can run prettier with `npm run prettier:format`. +You can setup git to run prettier automatically when you commit by installing the pre-commit hooks: `pip3 install pre-commit`, `pre-commit install`. + ## Code Contributions ### Development Setup @@ -95,6 +100,8 @@ ZMK uses `clang-format` to ensure consist formatting for our source code. Before changes, make sure you've manually run `clang-format`, or have your IDE configured to auto-format on save. +You can setup git to run `clang-format` automatically when you commit by installing the pre-commit hooks: `pip3 install pre-commit`, `pre-commit install`. + ### Commit Messages The ZMK project is working towards, but not yet enforcing, the use of |