https://github.com/hadenlabs/pre-commit-hooks
Pre commit hooks
https://github.com/hadenlabs/pre-commit-hooks
git hadenlabs iac peru pre-commit pre-commit-hook python
Last synced: 8 months ago
JSON representation
Pre commit hooks
- Host: GitHub
- URL: https://github.com/hadenlabs/pre-commit-hooks
- Owner: hadenlabs
- License: lgpl-3.0
- Created: 2021-03-31T20:30:58.000Z (almost 5 years ago)
- Default Branch: develop
- Last Pushed: 2022-07-18T17:16:38.000Z (over 3 years ago)
- Last Synced: 2025-04-21T10:56:09.666Z (10 months ago)
- Topics: git, hadenlabs, iac, peru, pre-commit, pre-commit-hook, python
- Language: Go
- Homepage:
- Size: 455 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: docs/contributing.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: docs/code_of_conduct.md
- Security: SECURITY.md
Awesome Lists containing this project
README
[](https://github.com/hadenlabs/pre-commit-hooks/releases) [](https://github.com/hadenlabs/pre-commit-hooks/actions?workflow=lint-code) [](https://github.com/hadenlabs/pre-commit-hooks/actions?workflow=test) [](https://github.com/hadenlabs/pre-commit-hooks/actions?workflow=cd) [](https://bestpractices.coreinfrastructure.org/projects/5156) [](https://github.com/pre-commit/pre-commit) [](https://conventionalcommits.org) [](https://keepachangelog.com)
# pre-commit-hooks
This repository is a collection of Git hooks to be used with the [pre-commit](https://pre-commit.com/) framework.
## Features
- [Terraform](https://github.com/terraform-linters/tflint)
- [Go](https://golang.org)
- [Markdown](https://github.com/tcort/markdown-link-check)
- [Shellcheck](https://github.com/koalaman/shellcheck)
- [Hadolint](https://github.com/hadolint/hadolint)
## TODO
- [chore: implement hook gnu make](https://github.com/hadenlabs/pre-commit-hooks/issues/2)
## Installation
### Base
1. Install [pre-commit](https://pre-commit.com/). E.g. `brew install pre-commit`
### MacOS
1. Install [Terraform](https://www.terraform.io/), [TFLint](https://github.com/terraform-linters/tflint), [Go](https://golang.org/), [markdown-link-check](https://github.com/tcort/markdown-link-check), [shellcheck](https://github.com/koalaman/shellcheck). E.g
```shell script
brew install terraform \
tflint \
go \
golangci/tap/golangci-lint \
shellcheck && \
yarn global add markdown-link-check
```
### Linux
## Usage
# How to use this project
## Examples
### Example: Run All Hooks
```shell script
pre-commit run --all-files
```
### Example: Run A Specific Hook
```shell script
pre-commit run terraform-validate --all-files
```
### terraform:
```yaml
repos:
- repo: https://github.com/hadenlabs/pre-commit-hooks
rev: 0.4.0
hooks:
- id: terraform-fmt
- id: terraform-validate
- id: terraform-docs
args:
- '--output-file=docs/include/terraform.md'
- '--output-mode=replace'
- '--sort-by-type'
- id: terraform-docs-replace
- id: terraform-tflint
- id: terraform-tfsec
- id: checkov
```
### terragrunt:
```yaml
repos:
- repo: https://github.com/hadenlabs/pre-commit-hooks
rev: 0.4.0
hooks:
- id: terragrunt-fmt
- id: terraform-validate
```
### markdown:
```yaml
repos:
- repo: https://github.com/hadenlabs/pre-commit-hooks
rev: 0.4.0
hooks:
- id: markdown-link-check
args:
- '--config=markdown-config.json'
```
### shell:
```yaml
repos:
- repo: https://github.com/hadenlabs/pre-commit-hooks
rev: 0.4.0
hooks:
- id: shellcheck
```
### Go:
```yaml
repos:
- repo: https://github.com/hadenlabs/pre-commit-hooks
rev: 0.4.0
hooks:
- id: go-fmt
- id: go-imports
- id: go-vet
- id: golint
- id: gocyclo
- id: validate-toml
- id: no-go-testing
- id: golangci-lint
- id: go-critic
- id: go-unit-tests
- id: go-build
- id: go-mod-tidy
- id: go-mod-vendor
```
### check:
```yaml
repos:
- repo: https://github.com/hadenlabs/pre-commit-hooks
rev: 0.4.0
hooks:
- id: todocheck
```
### grep:
```yaml
repos:
- repo: https://github.com/hadenlabs/pre-commit-hooks
rev: 0.4.0
hooks:
- id: do-not-commit
```
### docker:
```yaml
repos:
- repo: https://github.com/hadenlabs/pre-commit-hooks
rev: 0.4.0
hooks:
- id: hadolint
args:
- --config=.ci/linters/.hadolint.yaml
```
### docker-compose:
```yaml
repos:
- repo: https://github.com/hadenlabs/pre-commit-hooks
rev: 0.4.0
hooks:
- id: docker-compose-check
```
### gitleaks:
```yaml
repos:
- repo: https://github.com/hadenlabs/pre-commit-hooks
rev: 0.4.0
hooks:
- id: gitleaks
args:
- --path=.
- --repo-config-path=.ci/linters/.gitleaks.toml
- --verbose
```
### prepare-commit-msg:
```yaml
repos:
- repo: https://github.com/hadenlabs/pre-commit-hooks
rev: 0.4.0
hooks:
- id: prepare-commit-msg
stages: [prepare-commit-msg]
```
## Help
**Got a question?**
File a GitHub [issue](https://github.com/hadenlabs/pre-commit-hooks/issues).
## Contributing
See [Contributing](./docs/contributing.md).
## Module Versioning
This Module follows the principles of [Semantic Versioning (SemVer)](https://semver.org/).
Using the given version number of `MAJOR.MINOR.PATCH`, we apply the following constructs:
1. Use the `MAJOR` version for incompatible changes.
1. Use the `MINOR` version when adding functionality in a backwards compatible manner.
1. Use the `PATCH` version when introducing backwards compatible bug fixes.
### Backwards compatibility in `0.0.z` and `0.y.z` version
- In the context of initial development, backwards compatibility in versions `0.0.z` is **not guaranteed** when `z` is increased. (Initial development)
- In the context of pre-release, backwards compatibility in versions `0.y.z` is **not guaranteed** when `y` is increased. (Pre-release)
## Copyright
Copyright © 2018-2022 [Hadenlabs](https://hadenlabs.com)
## Trademarks
All other trademarks referenced herein are the property of their respective owners.
## License
The code and styles are licensed under the LGPL-3.0 license [See project license.](LICENSE).
## Don't forget to 🌟 Star 🌟 the repo if you like pre-commit-hooks
[Your feedback is appreciated](https://github.com/hadenlabs/pre-commit-hooks/issues)