Skip to content

Commit

Permalink
Add https://pre-commit.com integration (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile authored and motet-a committed Dec 26, 2018
1 parent e2272d5 commit 01e0a4d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- id: jinjalint
name: jinjalint
description: A linter which checks the indentation and the correctness of Jinja-like/HTML templates.
language: python
language_version: python3
entry: jinjalint
types: [jinja]
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,30 @@ $ jinjalint some-file.html some-other-file.html

This is a work in progress. Feel free to contribute :upside_down_face:


## Usage with [pre-commit](https://pre-commit.com) git hooks framework

Add to your `.pre-commit-config.yaml`:

```yaml
- repo: https://github.com/motet-a/jinjalint
rev: '' # select a tag / sha to point at
hooks:
- id: jinjalint
```
Make sure to fill in the `rev` with a valid revision.

_Note_: by default this configuration will only match `.jinja` and `.jinja2`
files. To match by regex pattern instead, override `types` and `files` as
follows:

```yaml
- id: jinjalint
types: [file] # restore the default `types` matching
files: \.(html|sls)$
```
## Hacking
Jinjalint is powered by [Parsy][parsy]. Parsy is an extremely powerful
Expand Down

0 comments on commit 01e0a4d

Please sign in to comment.