jumanjihouse / pre-commit-hooks

git pre-commit hooks that work with http://pre-commit.com/
MIT License
114 stars 52 forks source link

Trailing whitespaces for Jinja2 (.j2) files #78

Open kenorb opened 3 years ago

kenorb commented 3 years ago

I've a simple file template.j2:

/**
 * @file
 * My file
 */

which doesn't have any trailing whitespace, however the hook reports otherwise in every single line.

I'm using .j2 extension as this is a Jinja2 template. If I change to .j3 it works fine.

$  pre-commit run -a
Check for conflict markers and core.whitespace errors.......................Failed
- hook id: git-check
- exit code: 2

template.j2:1: trailing whitespace.
+/**
template.j2:2: trailing whitespace.
+ * @file
template.j2:3: trailing whitespace.
+ * My file
template.j2:4: trailing whitespace.
+ */

My .pre-commit-config.yaml:

---
repos:
  - repo: https://github.com/jumanjihouse/pre-commit-hooks
    rev: master
    hooks:
      - id: git-check

I've tried to add exclude: '(\.j2)$' but it didn't help.