Skip to content

Commit

Permalink
README: document pre-commit (#79)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
braydonk committed Jan 8, 2023
1 parent 66ce439 commit e1c97a1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)).

0 comments on commit e1c97a1

Please sign in to comment.