{"id":14963147,"url":"https://github.com/espressif/conventional-precommit-linter","last_synced_at":"2025-10-19T08:31:55.346Z","repository":{"id":173645740,"uuid":"650950387","full_name":"espressif/conventional-precommit-linter","owner":"espressif","description":"Pre-commit hook script for linting conventional commit style","archived":false,"fork":false,"pushed_at":"2024-10-03T16:01:44.000Z","size":1318,"stargazers_count":10,"open_issues_count":1,"forks_count":0,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-01-31T17:17:34.749Z","etag":null,"topics":["conventional-commits","espressif","pre-commit-hook"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/espressif.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-08T06:56:48.000Z","updated_at":"2024-10-03T16:01:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"d84deb7a-564a-4077-a999-ed12ea7d91e4","html_url":"https://github.com/espressif/conventional-precommit-linter","commit_stats":null,"previous_names":["espressif/conventional-precommit-linter"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/espressif%2Fconventional-precommit-linter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/espressif%2Fconventional-precommit-linter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/espressif%2Fconventional-precommit-linter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/espressif%2Fconventional-precommit-linter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/espressif","download_url":"https://codeload.github.com/espressif/conventional-precommit-linter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237092725,"owners_count":19254260,"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":["conventional-commits","espressif","pre-commit-hook"],"created_at":"2024-09-24T13:31:05.105Z","updated_at":"2025-10-19T08:31:49.865Z","avatar_url":"https://github.com/espressif.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003eConventional Precommit Linter\u003c/h1\u003e\n  \u003cimg src=\"docs/conventional-precommit-linter.jpg\" width=\"800\"\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n  \u003c!-- GitHub Badges --\u003e\n   \u003cimg alt=\"release\" src=\"https://img.shields.io/github/v/release/espressif/conventional-precommit-linter\" /\u003e\n   \u003cimg alt=\"tests\" src=\"https://github.com/espressif/conventional-precommit-linter/actions/workflows/pytest.yml/badge.svg\" /\u003e\n\u003c/div\u003e\nThe Conventional Precommit Linter is a tool designed to ensure commit messages follow the Conventional Commits standard, enhancing the readability and traceability of your project's history.\n\u003chr\u003e\n\n- [Usage](#usage)\n  - [Commit Message Structure](#commit-message-structure)\n- [Setup](#setup)\n  - [Install Commit-msg Hooks](#install-commit-msg-hooks)\n  - [Configuration](#configuration)\n- [Project issues](#project-issues)\n- [Contributing](#contributing)\n- [Credits](#credits)\n\n---\n\n## Usage\n\nThe _conventional-precommit-linter hook_ runs every time you execute the `git commit` command (when you want to commit your changes). Since this hook operates in the `commit-msg` stage, simply running a pre-commit check without actually committing (using `pre-commit run`), will have no effect, and this hook will be ignored.\n\nThe same applies to running pre-commit hooks in CI (Continuous Integration) job environments - **this hook is simply skipped when you run pre-commit checks in your CI system**.\n\n### Commit Message Structure\n\nCommit messages are validated against the following format:\n\n```\n\u003ctype\u003e(\u003coptional-scope\u003e): \u003csummary\u003e\n  \u003c ... empty line ... \u003e\n\u003coptional body lines\u003e\n\u003coptional body lines\u003e\n\u003coptional body lines\u003e\n```\n\nEach component is checked for compliance with the provided or default configuration.\n\nIf your commit message does not meet the required format, the hook will fail, producing a **report that shows which part of your commit message needs correction**:\n\n\u003cimg src=\"docs/example-output-default-args.png\" width=\"800\"\u003e\n\nFor a custom configuration, the report might look like this:\n\u003cimg src=\"docs/example-output-custom-args.png\" width=\"800\"\u003e\n\nThe hint message suggests that you can preserve your original message and simply edit it in your default editor, without the need to type the whole message again.\n\nTo edit failed message, run the command (as the hint suggests):\n\n```sh\ngit commit --edit --file=$(git rev-parse --git-dir)/COMMIT_EDITMSG\n```\n\nSince this command is quite complex and you may use this functionality often, **creating a Git alias might be a good idea**:\n\n```sh\ngit config --global alias.again '!git commit --edit --file=$(git rev-parse --git-dir)/COMMIT_EDITMSG'\n```\n\nThis command adds a `git again` alias to your machine's Git configuration. You can run then simply `git again` whenever your commit message check fails.\n\n---\n\n## Setup\n\nTo integrate the **Conventional Precommit Linter** into your project, add to your `.pre-commit-config.yaml`:\n\n```yaml\n# FILE: .pre-commit-config.yaml\nrepos:\n  - repo: https://github.com/espressif/conventional-precommit-linter\n    rev: v1.7.0 # The version tag you wish to use\n    hooks:\n      - id: conventional-precommit-linter\n        stages: [commit-msg]\n```\n\n### Install Commit-msg Hooks\n\n**IMPORTANT:** `commit-msg` hooks require a specific installation command:\n\n```sh\npre-commit install -t pre-commit -t commit-msg\n```\n\n**Note:** The `pre-commit install` command by default sets up only the `pre-commit` stage hooks. The additional flag `-t commit-msg` is necessary to set up `commit-msg` stage hooks.\n\nFor a simplified setup (just with `pre-commit install` without flags), ensure your `.pre-commit-config.yaml` contains the following:\n\n```yaml\n# FILE: .pre-commit-config.yaml\n---\nminimum_pre_commit_version: 3.3.0\ndefault_install_hook_types: [pre-commit, commit-msg]\n```\n\nAfter modifying `.pre-commit-config.yaml`, re-run the installation command (`pre-commit install`) for changes to take effect.\n\n-\n\n### Configuration\n\nThe linter accepts several configurable parameters to tailor commit message validation:\n\n- `--types`: Define the types of commits allowed (default: [`change`, `ci`, `docs`, `feat`, `fix`, `refactor`, `remove`, `revert`, `test`]).\n- `--scopes`: Specifies a list of allowed scopes. If not defined, all scopes are allowed (restriction is `disabled`).\n- `--scope-case-insensitive`: Allows uppercase letters in scope.\n- `--subject-min-length`: Set the minimum length for the summary (default: `20`).\n- `--subject-max-length`: Set the maximum length for the summary (default: `72`).\n- `--body-max-line-length`: Set the maximum line length for the body (default: `100`).\n- `--summary-uppercase`: Enforce the summary to start with an uppercase letter (default: `disabled`).\n- `--allow-breaking`: Allow exclamation mark in the commit type (default: `false`).\n\nThe **custom configuration** can be specified in `.pre-commit-config.yaml` like this:\n\n```yaml\n# FILE: .pre-commit-config.yaml\n---\n- repo: https://github.com/espressif/conventional-precommit-linter\n  rev: v1.7.0 # The version tag you wish to use\n  hooks:\n    - id: conventional-precommit-linter\n      stages: [commit-msg]\n      args:\n        - --types=build,ci,docs,feat,fix,perf,refactor,style,test # default Angular / @commitlint-conventional types\n        - --scopes=bt,wifi,ethernet\n        - --subject-min-length=10\n```\n\n---\n\n## Project issues\n\nIf you encounter any issues, feel free to report them in the [project's issues](https://github.com/espressif/conventional-precommit-linter/issues) or create Pull Request with your suggestion.\n\n---\n\n## Contributing\n\n📘 If you are interested in contributing to this project, see the [project Contributing Guide](CONTRIBUTING.md).\n\n---\n\n## Credits\n\nInspired by project: https://github.com/compilerla/conventional-pre-commit\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fespressif%2Fconventional-precommit-linter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fespressif%2Fconventional-precommit-linter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fespressif%2Fconventional-precommit-linter/lists"}