https://github.com/flaudisio/pre-commit-hooks
Miscellaneous hooks for pre-commit.
https://github.com/flaudisio/pre-commit-hooks
pre-commit pre-commit-hooks
Last synced: 2 months ago
JSON representation
Miscellaneous hooks for pre-commit.
- Host: GitHub
- URL: https://github.com/flaudisio/pre-commit-hooks
- Owner: flaudisio
- License: mit
- Created: 2019-09-20T15:39:44.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-09-09T23:00:13.000Z (4 months ago)
- Last Synced: 2025-09-10T02:46:52.947Z (4 months ago)
- Topics: pre-commit, pre-commit-hooks
- Language: Shell
- Homepage:
- Size: 64.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pre-commit hooks
Miscellaneous hooks for [pre-commit](https://pre-commit.com/).
## Hooks available
- `check-zero-width-spaces` - Forbid files which have one or more zero width spaces (U+200B).
- `hadolint` - Run [Hadolint](https://github.com/hadolint/hadolint) on Dockerfiles.
- You may use any Hadolint CLI argument, e.g. [`--config example.yaml`](https://github.com/hadolint/hadolint#configure),
[`--ignore RULE`](https://github.com/hadolint/hadolint#rules), `--trusted-registry REGISTRY`, etc
See the [example](#full-example) below.
- `nomad-fmt` - Run [`nomad fmt`](https://developer.hashicorp.com/nomad/commands/fmt) on Nomad manifests.
- `packer-validate` - Run [`packer validate`](https://developer.hashicorp.com/packer/docs/commands/validate)
on JSON files.
## How to install
1. Install dependencies:
- [pre-commit](https://pre-commit.com/#install)
- [Hadolint](https://github.com/hadolint/hadolint/releases) (for `hadolint`)
- [Nomad](https://developer.hashicorp.com/nomad/install) (for `nomad-fmt`)
- [Packer](https://developer.hashicorp.com/packer/install) (for `packer-validate`)
1. Install the pre-commit hook globally:
```bash
pre-commit init-templatedir -t pre-commit ~/.git-template
```
1. Create the `.pre-commit-config.yaml` file:
```bash
cd /path/to/my/repo/
vim .pre-commit-config.yaml
```
**Tip:** use the example from the next section as a start point.
1. Run:
```bash
pre-commit run -a
```
## Full example
```yaml
# .pre-commit-config.yaml
repos:
- repo: https://github.com/flaudisio/pre-commit-hooks
rev: v0.11.1
hooks:
- id: check-zero-width-spaces
- id: hadolint
args:
- --config .hadolint.strict.yaml
- --ignore DL3013
- --ignore DL3018
- --trusted-registry registry.example.com:5000
exclude: ^cookiecutter/.+/Dockerfile$
- id: packer-validate
files: ^templates/.+\.json$
```
## License
[MIT](LICENSE).