This repository provides two pre-commit hooks on top of inifix (and its companion
command line interface, inifix-cli):
inifix-validateinifix-format
Both these hooks can be configured by adding the following snippets to
.pre-commit-config.yaml
- repo: https://github.com/la-niche/inifix-pre-commit.git
rev: v1.0.0
hooks:
- id: inifix-validateor
- repo: https://github.com/la-niche/inifix-pre-commit.git
rev: v1.0.0
hooks:
- id: inifix-formatNote that inifix-format also validates data by default, so it is redundant to
enable both hooks with no further configuration. Validation and formatting may
nonetheless be decoupled as
- repo: https://github.com/la-niche/inifix-pre-commit.git
rev: v1.0.0
hooks:
- id: inifix-validate
- id: inifix-format
+ args: [--skip-validation]By default, both hooks target files matching the regular expression (\.ini)$.
It is possible to override this expression as, e.g.,
hooks:
- id: inifix-format
+ files: (\.ini|\.par)$For convenience, in cases where the appropriate regular expression is hard to write,
for instance if your project contains some files with a .ini extension that are not
intended to be used with idefix, you may refine the selection via exclude patterns,
using --exclude and/or --extend-exclude. By default, files named pytest.ini or
tox.ini are excluded.