{"id":36985160,"url":"https://github.com/pegasusheavy/cargo-commitlint","last_synced_at":"2026-01-13T23:01:02.998Z","repository":{"id":328875125,"uuid":"1117147296","full_name":"pegasusheavy/cargo-commitlint","owner":"pegasusheavy","description":"A Rust-based commit message linter following Conventional Commits specification. Configurable via TOML, integrates with cargo-husky, and validates commit messages for Rust projects.","archived":false,"fork":false,"pushed_at":"2026-01-12T10:55:02.000Z","size":399,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-13T19:40:22.880Z","etag":null,"topics":["cargo","cargo-subcommand","cli-tool","code-quality","commit-message","commitlint","conventional-commits","git-hooks","linting","rust","rust-tooling","toml"],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/pegasusheavy.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":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-15T22:39:42.000Z","updated_at":"2026-01-11T02:58:32.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/pegasusheavy/cargo-commitlint","commit_stats":null,"previous_names":["pegasusheavy/cargo-commitlint"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/pegasusheavy/cargo-commitlint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pegasusheavy%2Fcargo-commitlint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pegasusheavy%2Fcargo-commitlint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pegasusheavy%2Fcargo-commitlint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pegasusheavy%2Fcargo-commitlint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pegasusheavy","download_url":"https://codeload.github.com/pegasusheavy/cargo-commitlint/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pegasusheavy%2Fcargo-commitlint/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28405148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cargo","cargo-subcommand","cli-tool","code-quality","commit-message","commitlint","conventional-commits","git-hooks","linting","rust","rust-tooling","toml"],"created_at":"2026-01-13T23:00:49.370Z","updated_at":"2026-01-13T23:01:02.977Z","avatar_url":"https://github.com/pegasusheavy.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cargo-commitlint\n\nA Rust-based commit message linter following the [Conventional Commits](https://www.conventionalcommits.org/) specification. Similar to Node.js's `commitlint`, but written entirely in Rust and designed for the Rust ecosystem.\n\n## Features\n\n- ✅ Validates commit messages against Conventional Commits specification\n- ✅ Configurable via TOML (similar to `commitlint`)\n- ✅ Git hook integration (similar to `cargo-husky`)\n- ✅ Supports all standard Conventional Commit types\n- ✅ Customizable rules for type, scope, subject, body, and footer\n- ✅ Regex-based commit message parsing\n- ✅ Ignore patterns for skipping validation\n\n## Installation\n\n### From Source\n\n```bash\ngit clone https://github.com/pegasusheavy/cargo-commitlint.git\ncd cargo-commitlint\ncargo install --path .\n```\n\n### From Crates.io (when published)\n\n```bash\ncargo install cargo-commitlint\n```\n\n## Usage\n\nAfter installation, `cargo-commitlint` is available as a cargo subcommand. Use it with:\n\n```bash\ncargo commitlint \u003ccommand\u003e\n```\n\n### Git Hooks with cargo-husky\n\nThis project uses `cargo-husky` to manage git hooks. The hooks are automatically installed when you run `cargo test`.\n\n#### Available Hooks\n\n- **pre-commit**: Runs `cargo fmt --check` and `cargo clippy` to ensure code quality\n- **pre-push**: Runs `cargo test` to ensure all tests pass before pushing\n- **commit-msg**: Validates commit messages using `cargo commitlint` and Conventional Commits\n\n#### Installing Hooks\n\nSimply run:\n\n```bash\ncargo test\n```\n\nThis will compile the project and install all git hooks configured in `.cargo-husky/hooks/`.\n\n#### Manual Git Hook Installation (Alternative)\n\nIf you prefer to use `cargo commitlint`'s built-in hook installer instead of `cargo-husky`:\n\n```bash\ncargo commitlint install\n```\n\nThis will create a `.git/hooks/commit-msg` hook that validates all commit messages using `cargo commitlint`.\n\n### Uninstall Git Hook\n\nRemove the git hook:\n\n```bash\ncargo commitlint uninstall\n```\n\n### Validate Commit Messages\n\nValidate a commit message directly:\n\n```bash\n# Validate from command line\ncargo commitlint check --message \"feat: add new feature\"\n\n# Validate from stdin\necho \"feat: add new feature\" | cargo commitlint check\n```\n\n### Configuration\n\nCreate a `commitlint.toml` or `.commitlint.toml` file in your project root. You can copy `commitlint.example.toml` as a starting point:\n\n```bash\ncp commitlint.example.toml commitlint.toml\n```\n\n#### Example Configuration\n\n```toml\n[rules]\n# Type validation\n[rules.type]\nenum = [\"feat\", \"fix\", \"docs\", \"style\", \"refactor\", \"test\", \"chore\"]\ncase = \"lowercase\"\n\n# Scope validation\n[rules.scope]\nenum = []  # Empty means all scopes allowed\ncase = \"lowercase\"\n\n# Subject validation\nsubject_case = [\"sentence-case\"]\nsubject_empty = false\nsubject_full_stop = \".\"\n\n# Header validation\nheader_max_length = 72\nheader_min_length = 0\n\n# Body validation\nbody_leading_blank = true\nbody_max_line_length = 100\n\n# Footer validation\nfooter_leading_blank = true\nfooter_max_line_length = 100\n\n# Parser configuration\n[parser]\npattern = \"^(?P\u003ctype\u003e\\\\w+)(?:\\\\((?P\u003cscope\u003e[^)]+)\\\\))?(?P\u003cbreaking\u003e!)?:\\\\s(?P\u003csubject\u003e.*)$\"\n\n# Ignore patterns (regex)\nignores = [\n    # \"Merge.*\",\n    # \"Revert.*\",\n]\n```\n\n## Conventional Commits Format\n\nThe tool validates commit messages in the following format:\n\n```\n\u003ctype\u003e[optional scope]: \u003cdescription\u003e\n\n[optional body]\n\n[optional footer(s)]\n```\n\n### Types\n\n- `feat`: A new feature\n- `fix`: A bug fix\n- `docs`: Documentation only changes\n- `style`: Changes that do not affect the meaning of the code\n- `refactor`: A code change that neither fixes a bug nor adds a feature\n- `perf`: A code change that improves performance\n- `test`: Adding missing tests or correcting existing tests\n- `build`: Changes that affect the build system or external dependencies\n- `ci`: Changes to CI configuration files and scripts\n- `chore`: Other changes that don't modify src or test files\n- `revert`: Reverts a previous commit\n\n### Examples\n\nValid commit messages:\n\n```\nfeat: add user authentication\nfeat(api): add new endpoint\nfix: resolve memory leak in parser\ndocs: update README with installation instructions\nfeat!: breaking change in API\n\nfeat: add feature\n\nThis is a longer description of the change.\n\nCloses #123\n```\n\nInvalid commit messages:\n\n```\ninvalid: bad commit type\nfeat:Missing colon\nfeat: subject too long and exceeds the maximum length limit of 72 characters\n```\n\n## Configuration Options\n\n### Rules\n\n- `rules.type.enum`: List of allowed commit types (empty = all allowed)\n- `rules.type.case`: Case requirement (`lowercase`, `uppercase`, `camel-case`, `kebab-case`, `pascal-case`, `snake-case`)\n- `rules.scope.enum`: List of allowed scopes (empty = all allowed)\n- `rules.scope.case`: Case requirement for scope\n- `rules.subject_case`: List of allowed case formats (`sentence-case`, `lowercase`, `uppercase`, `start-case`)\n- `rules.subject_empty`: Whether subject can be empty\n- `rules.subject_full_stop`: Character that should not appear at end of subject\n- `rules.header_max_length`: Maximum header length\n- `rules.header_min_length`: Minimum header length\n- `rules.body_leading_blank`: Require blank line before body\n- `rules.body_max_line_length`: Maximum line length in body\n- `rules.footer_leading_blank`: Require blank line before footer\n- `rules.footer_max_line_length`: Maximum line length in footer\n\n### Parser\n\n- `parser.pattern`: Regex pattern for parsing conventional commits\n- `parser.correspondence`: Map regex capture groups to commit fields\n\n### Ignores\n\n- `ignores`: List of regex patterns for commits to skip validation\n\n## Integration with Cargo\n\nThis tool is designed to work seamlessly with Rust projects and integrates with `cargo-husky` for comprehensive git hook management.\n\n### Using cargo-husky (Recommended)\n\nThis project includes `cargo-husky` configuration with pre-commit, pre-push, and commit-msg hooks:\n\n1. **Pre-commit hook**: Ensures code is formatted (`cargo fmt`) and passes clippy checks\n2. **Pre-push hook**: Runs all tests before allowing pushes\n3. **Commit-msg hook**: Validates commit messages using `cargo commitlint`\n\nTo activate the hooks, simply run:\n\n```bash\ncargo test\n```\n\nThe hooks are defined in `.cargo-husky/hooks/` and will be automatically installed.\n\n### Using cargo commitlint's Built-in Hook Installer\n\nAlternatively, you can use `cargo commitlint`'s built-in installer:\n\n```bash\ncargo commitlint install\n```\n\nThis will install only the commit-msg hook for commit message validation.\n\n## License\n\nLicensed under the MIT License.\n\nCopyright (c) 2025 Pegasus Heavy Industries LLC\n\nSee [LICENSE](LICENSE) or [LICENSE-MIT](LICENSE-MIT) for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpegasusheavy%2Fcargo-commitlint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpegasusheavy%2Fcargo-commitlint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpegasusheavy%2Fcargo-commitlint/lists"}