Skip to content

cicd-tools-org/pre-commit

Repository files navigation

Pre-Commit Hooks for CICD-Tools

cicd-tools pre-commit

Branch Build
main workflow-link
dev workflow-link

This repository provides pre-commit hooks for the CICD-Tools project.

Containerization and Pre-Commit

These hooks all rely on 3rd party software to perform different types of static analysis:

  • Some of this software can be managed by the end user project's themselves.
  • Other software packages are provided by containers.

For this reason we strongly recommend installing a container runtime such as Docker or Colima on your development machine if you are consuming these hooks.

Included Pre-Commit Hooks

Hook Name Description
cicd-tools-schema-cookiecutter Runs json-schema to validate a cookiecutter config file against the CICD-Tools schema.
cicd-tools-schema-manifest Runs json-schema to validate a CICD-Tools manifest against the CICD-Tools schema.
format-shell Runs shfmt to format your shell scripts.
format-toml Runs tomll to format your TOML configuration files.
gettext-translations-add Runs gettext utilities to support adding additional languages.
gettext-translations-compile Runs gettext utilities to compile '.mo' files from '.po' files.
gettext-translations-missing Runs gettext utilities to search for missing translations.
gettext-translations-update Runs gettext utilities to extract translations and update all files.
git-conflict-markers Runs git to check for left over conflict markers in your commit.
lint-github-workflow Optionally runs actionlint on all GitHub workflows.
lint-github-workflow-header Optionally runs a shell script to lint GitHub workflow headers.
lint-markdown Runs markdown-lint on your Markdown files.
lint-shell Runs shellcheck to lint all shell scripts.
pre-commit-sort-config Runs yq to sort your .pre-commit-config.yaml file.
pre-commit-sort-hooks Runs yq to sort your .pre-commit-hooks.yaml file.
security-credentials Runs trufflehog to ensure you don't commit secrets to your codebase.
spelling-commit-message Runs vale on your git commit messages to check for spelling errors.
spelling-markdown Runs vale on your Markdown files to check for spelling errors.
spelling-vale-sync Enables manually running vale to download remote packages.
spelling-vale-vocab Enables automated sorting of vale vocabularies.
poetry-lint-ansible Runs ansible-lint to check for Ansible best practices and behaviours.
poetry-lint-python Runs pylint on all Python files to perform static code analysis.
poetry-types-python Runs mypy on all Python files to check typing.

Implementation Details

Hook Name Exe Source Implementation
cicd-tools-schema-cookiecutter pre-commit venv The Python package check-jsonschema is invoked.
cicd-tools-schema-manifest pre-commit venv The Python package check-jsonschema is invoked.
format-shell CICD-Tools The CICD-Tools utilities container is used to invoke this tool.
format-toml CICD-Tools The CICD-Tools utilities container is used to invoke this tool.
gettext-translations-add CICD-Tools A custom script is invoked which uses the CICD-Tools gettext container.
gettext-translations-compile CICD-Tools A custom script is invoked which uses the CICD-Tools gettext container.
gettext-translations-missing CICD-Tools A custom script is invoked which uses the CICD-Tools gettext container.
gettext-translations-update CICD-Tools A custom script is invoked which uses the CICD-Tools gettext container.
git-conflict-markers local binary The local git binary is invoked.
lint-github-workflow CICD-Tools The CICD-Tools utilities container is used to invoke this tool.
lint-github-workflow-header shell A custom script is invoked.
lint-markdown 3rd party The official markdownlint-cli container is used to invoke this tool.
lint-shell CICD-Tools The CICD-Tools utilities container is used to invoke this tool.
pre-commit-sort-config CICD-Tools A custom script is invoked which uses the CICD-Tools utilities container.
pre-commit-sort-hooks CICD-Tools A custom script is invoked which uses the CICD-Tools utilities container.
security-credentials 3rd Party The official trufflehog container is used to invoke this tool.
spelling-commit-message CICD-Tools A custom script is invoked which uses the CICD-Tools utilities container.
spelling-markdown CICD-Tools The CICD-Tools utilities container is used to invoke this tool.
spelling-vale-sync CICD-Tools The CICD-Tools utilities container is used to invoke this tool.
spelling-vale-vocab shell The local shell binary is used to invoke a one-liner.
lint-ansible poetry environment A custom script and the local poetry environment is used to invoke this tool.
poetry-lint-python poetry environment The project's poetry environment is used to invoke this tool.
poetry-types-python poetry environment The project's poetry environment is used to invoke this tool.

License

MPL-2