From e1c97a1b3ffd0f3cfb37685b6a046d5f6963f2d8 Mon Sep 17 00:00:00 2001 From: Braydon Kains <93549768+braydonk@users.noreply.github.com> Date: Sun, 8 Jan 2023 13:08:48 -0500 Subject: [PATCH] README: document pre-commit (#79) * README: document pre-commit This PR documents the pre-commit installation instructions. Do not merge this PR til v0.8.0 * change version to 0.7.1 --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 4d0c7b6..3c04059 100644 --- a/README.md +++ b/README.md @@ -97,3 +97,16 @@ formatter: If the type is not specified, the default formatter will be used. In the tool included in this repo, the default is the [basic formatter](formatters/basic). For in-depth configuration documentation see the [config docs](docs/config.md). + +# pre-commit + +Starting in v0.7.1, `yamlfmt` can be used as a hook for the popular [pre-commit](https://pre-commit.com/) tool. To include a `yamlfmt` hook in your `pre-commit` config, add the following to the `repos` block in your `.pre-commit-config.yaml`: + +```yaml +- repo: https://github.com/google/yamlfmt + rev: v0.7.1 + hooks: + - id: yamlfmt +``` + +When running yamlfmt with the `pre-commit` hook, the only way to configure it is through a `.yamlfmt` configuration file in the root of the repo or a system wide config directory (see [Configuration File](#configuration-file)). \ No newline at end of file