Mirror of dclint package for pre-commit.
- For
pre-commit
: see https://github.com/pre-commit/pre-commit - For
dclint
: see https://github.com/zavoloklom/docker-compose-linter
This repository provides both a Node.js and Docker-based pre-commit
hook to validate and enforce best practices
automatically before committing.
Add the following to your .pre-commit-config.yaml
:
repos:
- repo: https://github.com/docker-compose-linter/pre-commit-dclint
rev: v3.1.0 # Matches the dclint version, use the sha or tag you want to point at
hooks:
- id: dclint
# Optional: regex override for compose files
files: ^(docker-)?compose\.ya?ml
# Optional: enable autofix on commit
args: [ --fix ]
If you prefer not to install Node.js, you can run dclint via Docker:
repos:
- repo: https://github.com/docker-compose-linter/pre-commit-dclint
rev: v3.1.0 # Matches the dclint version, use the sha or tag you want to point at
hooks:
- id: dclint-docker
# Optional: regex override for compose files
files: ^(docker-)?compose\.ya?ml$
# Optional: enable autofix on commit
args: [ --fix ]
For a full list of supported CLI arguments, see the official documentation.
Note that the -r
(or --recursive
) flag does not influence how pre-commit selects files to run hooks on. Instead,
pre-commit uses the files:
regex to determine which files should trigger the hook. This regex is applied to all
changed file paths before the hook is invoked. If a file doesn’t match the pattern, the hook won’t run at all —
regardless of whether --recursive
is used internally.
In this setup, the files:
regex is already configured to match nested compose.yaml
files, so pre-commit can
correctly detect relevant changes and invoke the hook only when needed.
This mirror is automatically updated to match the latest dclint version published on npm and docker registry.
Version synchronization is maintained via GitHub Actions on a weekly schedule.
This project is licensed under the MIT License. See the LICENSE file for more information.
If you find this repository helpful, kindly consider showing your appreciation by giving it a star ⭐.
If you have any questions or suggestions, feel free to reach out:
- Email: [email protected]
- Х/Twitter: zavoloklom
- Instagram: zavoloklom
- GitHub: zavoloklom
Also, you can support this project with a one-time donation or becoming a sponsor: