Skip to content

waisbrot/pre-commit-jsonnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Jsonnetfmt as a pre-commit hook

jsonnetfmt is a code-formatter that comes with Jsonnet.

Pre-Commit is a library for creating and applying Git pre-commit hooks easily.

Together, you can automatically run jsonnetfmt before any commit, automatically.

Installing

  1. Get pre-commit: pip install pre-commit
  2. Create a .pre-commit.config.yaml file in the root of your repository:
---
repos:
    - repo: https://github.com/waisbrot/pre-commit-jsonnet.git
      rev: v1.0
      hooks:
          - id: jsonnetfmt
  1. Install the hooks: pre-commit install
  2. Commit code including a .jsonnet or .libsonnet file and it will run through jsonnetfmt
  3. If the file was modified, pre-commit will abort the commit so you can check the changes. (git diff will show you changes between what you staged and what jsonnetfmt did.) Stage the modifications and commit again.

About

Pre-commit hook repo for jsonnetfmt

Resources

License

Stars

Watchers

Forks

Packages

No packages published