Skip to content

Commit

Permalink
feat: allow the use of yamlfix as a pre-commit hook
Browse files Browse the repository at this point in the history
Closes #10
  • Loading branch information
lyz-code committed Feb 5, 2021
1 parent cb11882 commit 2191e71
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
10 changes: 10 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- id: yamlfix
name: yamlfix
entry: yamlfix
require_serial: true
language: python
language_version: python3
types_or: [cython, pyi, python]
args: []
minimum_pre_commit_version: 2.9.0
22 changes: 20 additions & 2 deletions docs/editor_integration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
For a smother experience, you can run `yamlfix` each time you save your file
in your editor.
For a smoother experience, you can run `yamlfix` automatically each time each
time you save your file in your editor or when you run `git commit`.

# Vim

Expand All @@ -12,3 +12,21 @@ plugin](https://github.com/dense-analysis/ale).
post](https://lyz-code.github.io/blue-book/linux/vim/vim_plugins/#ale).

`ale` is configured to run `yamlfix` automatically by default.

# [pre-commit](https://pre-commit.com/)

You can run `yamlfix` before we do a commit using the
[pre-commit](https://pre-commit.com/) framework. If you don't know how to use
it, follow [these
guidelines](https://lyz-code.github.io/blue-book/devops/ci/#configuring-pre-commit).

You'll need to add the following lines to your project's
`.pre-commit-config.yaml` file.

```yaml
repos:
- repo: https://github.com/lyz-code/yamlfix/
rev: master
hooks:
- id: yamlfix
```

0 comments on commit 2191e71

Please sign in to comment.