{"id":16130080,"url":"https://github.com/dj-wasabi/pre-commit-hooks","last_synced_at":"2025-03-18T14:30:54.646Z","repository":{"id":46018308,"uuid":"295139331","full_name":"dj-wasabi/pre-commit-hooks","owner":"dj-wasabi","description":"A bunch of personal pre-commit-hooks to improve code and quality","archived":false,"fork":false,"pushed_at":"2025-03-10T18:14:05.000Z","size":102,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-10T19:28:02.431Z","etag":null,"topics":["git","hooks","pre-commit","python"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dj-wasabi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"dj-wasabi","patreon":"wernerdijkerman"}},"created_at":"2020-09-13T11:43:20.000Z","updated_at":"2025-03-10T18:14:09.000Z","dependencies_parsed_at":"2024-10-27T18:19:13.704Z","dependency_job_id":null,"html_url":"https://github.com/dj-wasabi/pre-commit-hooks","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dj-wasabi%2Fpre-commit-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dj-wasabi%2Fpre-commit-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dj-wasabi%2Fpre-commit-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dj-wasabi%2Fpre-commit-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dj-wasabi","download_url":"https://codeload.github.com/dj-wasabi/pre-commit-hooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243933413,"owners_count":20370987,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","hooks","pre-commit","python"],"created_at":"2024-10-09T22:14:24.964Z","updated_at":"2025-03-18T14:30:54.398Z","avatar_url":"https://github.com/dj-wasabi.png","language":"Shell","funding_links":["https://github.com/sponsors/dj-wasabi","https://patreon.com/wernerdijkerman"],"categories":[],"sub_categories":[],"readme":"# Pre-commit-hooks\n\n**Table of contents**\n\u003c!--TOC--\u003e\n\n- [Pre-commit-hooks](#pre-commit-hooks)\n  - [Hooks](#hooks)\n  - [Scripts](#scripts)\n- [Installation](#installation)\n  - [Prerequisites Documentation](#prerequisites-documentation)\n    - [terraform-docs](#terraform-docs)\n    - [terraform-docs-adoc](#terraform-docs-adoc)\n    - [markdown-toc](#markdown-toc)\n  - [Supporting packages](#supporting-packages)\n  - [Usage](#usage)\n    - [no-commit-on-branch](#no-commit-on-branch)\n\n\u003c!--TOC--\u003e\n\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit\u0026logoColor=white)](https://github.com/dj-wasabi/pre-commit-hooks)\n\n## Hooks\n\nThis pre-commit-hooks repository contains the following hooks.\n\n| Hook name     | Description |\n|---------------|------------|\n|terraform-docs| Inserts input and output documentation into `README.md` (using terraform-docs).|\n|terraform-docs-adoc|Inserts input and output documentation into `README.adoc` (using terraform-docs).|\n|terraform-validate|Validates all Terraform configuration files.|\n|terraform-sec|Static analysis of Terraform templates to spot potential security issues.|\n|terraform-lint|Validates all Terraform configuration files with TFLint.|\n|terraform-fmt|Rewrites all Terraform configuration files to a canonical format.|\n|checkov|Runs checkov on Terraform templates.|\n|helm-lint|Run helm lint, a linter for helm charts|\n|helm-unittest|This hook run helm unittest from quintush/helm-unittest|\n|docker-lint|Runs hadolint to lint Dockerfiles|\n|shellcheck|Performs linting on bash scripts|\n|verify-json|Checks JSON files and pretty prints them|\n|verify-yaml|Checks YAML files and pretty prints them|\n|markdown-toc|Generate a Table of Contents in a Markdown Document|\n|no-commit-on-branch|Do no allow any commit on either specified branch.|\n\nThe hook name can be used with the `.pre-commit-config.yaml` as `id`. See [usage](#usage) for an example.\n\n## Scripts\n\nA bunch of scripts (founds on different places, provided link where they were found) that would help me to create better code.\n\nThe following scripts are in this repository in the `bin/` directory:\n* docker-lint;\n* terraform-docs (https://raw.githubusercontent.com/antonbabenko/pre-commit-terraform/master/terraform_docs.sh);\n* terraform-fmt (https://raw.githubusercontent.com/antonbabenko/pre-commit-terraform/master/terraform_fmt.sh);\n* terraform-lint (https://raw.githubusercontent.com/antonbabenko/pre-commit-terraform/master/terraform_tflint.sh);\n* terraform-sec (https://raw.githubusercontent.com/antonbabenko/pre-commit-terraform/master/terraform_tfsec.sh);\n* terraform-validate (https://raw.githubusercontent.com/antonbabenko/pre-commit-terraform/master/terraform_validate.sh);\n* helm-lint (https://raw.githubusercontent.com/gruntwork-io/pre-commit/master/hooks/helmlint.sh);\n* helm-unittest (HELM Plugin: https://github.com/quintush/helm-unittest);\n* shellcheck (https://raw.githubusercontent.com/gruntwork-io/pre-commit/master/hooks/shellcheck.sh);\n* verify-json.sh\n* verify-yaml.sh\n* markdown-toc.sh\n* no-commit-on-branch.sh\n\n# Installation\n\n```sh\nbrew install pre-commit\n```\n\n## Prerequisites Documentation\n\nThe following needs to be set in order to get several hooks work related to documentation.\n\n### terraform-docs\n\nFor updating Markdown documentation with information that is generated from Terraform, you will need to add the following 2 lines in the document.\n\n```md\n\u003c!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --\u003e\n\u003c!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --\u003e\n```\n\n### terraform-docs-adoc\n\nFor updating Asciidoctor documentation with information that is generated from Terraform, you will need to add the following 2 lines in the document.\n\n```md\n// BEGIN TERRAFORM ASCIIDOC\n// END TERRAFORM ASCIIDOC\n```\n\nDefault, the `README.adoc` in the ROOT of the repository will be updated. You can also specify a different asciidoctor file:\n\n```yaml\n    - id: terraform-docs-adoc\n      args: [\"-s src\", \"-f documentation/index.adoc\"]\n```\n\nWhere `-f` is the location to the asciidoctor file. With `-s` you can override and specify a directory containing the Terraform code (Default `.` is used).\n\n### markdown-toc\n\nThe following needs to be added in the Markdown document to generate a Table of content:\n\n```md\n\u003c!--TOC--\u003e\n```\n\n## Supporting packages\n\nThe following needs to be installed when you want to use all of the hooks.\n\n```sh\nbrew tap liamg/tfsec\nbrew install gawk terraform-docs tflint tfsec coreutils helm hadolint shellcheck\n```\n\n```sh\npip install checkov ansible-lint yamlfmt md-toc\n```\n\nInstall the HELM Unittests\n```sh\nhelm plugin install https://github.com/quintush/helm-unittest\n```\n\n## Usage\n\nCreate a file named `.pre-commit-config.yaml` in the repository.\n\nAdd something like the following:\n\n```yaml\n---\nrepos:\n- repo: https://github.com/dj-wasabi/pre-commit-hooks\n  rev: master\n  hooks:\n    - id: terraform-fmt\n    - id: terraform-docs\n    - id: terraform-sec\n```\n\nWhen the file is added, run the following command to install it:\n\n```s\npre-commit install\n```\n\nNow, when you do a `git commit` the hooks are executed. You can manually run the hooks by executing the following command:\n\n```sh\npre-commit run -a\n```\n\n### no-commit-on-branch\n\nThe following is an example on how to not allow commits into the `main` or `master` branch:\n\n```yaml\n---\nrepos:\n- repo: https://github.com/dj-wasabi/pre-commit-hooks\n  rev: master\n  hooks:\n    - id: no-commit-on-branch\n      args: ['-b master,main']\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdj-wasabi%2Fpre-commit-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdj-wasabi%2Fpre-commit-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdj-wasabi%2Fpre-commit-hooks/lists"}