noirbizarre / noirbizarre/rust.tpl
commitlint pulls node into a Rust project; `conventional-pre-commit` does the same job in Python
Nobody has claimed this yet.
- Dominant language
- Jinja
- Stars
- 2
- Forks
- 0
- Avg merge
- 30m
- Merged PRs (30d)
- 6
Description
Commit-message linting is the only thing in a rendered project that needs node.
template/prek.toml.jinja:21-28:
[[repos]]
repo = "https://github.com/alessandrojcm/commitlint-pre-commit-hook"
rev = "v9.21.0"
[[repos.hooks]]
id = "commitlint"
stages = ["commit-msg"]
additional_dependencies = ["@commitlint/config-conventional"]
The fallout, in every rendered project:
template/commitlint.config.mjs— a two-line file whose only content isextends: ["@commitlint/config-conventional"]template/.gitignore:16-17—# Installed by the commitlint prek hook./node_modules/- node and npm required on
PATHatgit committime, in a project that otherwise needs only Rust and mise
rust.tpl's own prek.toml:17-24 carries the identical block, so the template repository pays it too.
The alternative, already in use in one of your Rust projects
compilerla/conventional-pre-commit is a pure-Python hook doing the same job. oxyde/mark — a Rust/PyO3 project — uses it:
# Conventional commit message validation
[[repos]]
repo = "https://github.com/compilerla/conventional-pre-commit"
rev = "v4.0.0"
hooks = [
{ id = "conventional-pre-commit", stages = ["commit-msg"] },
]
Switching drops the .mjs, the node_modules/ ignore entry, and the node dependency. prek already provides Python, so nothing new is pulled in.
The part that makes this three files, not one
template/.github/ship.yml.jinja:19-23 names the linter explicitly to justify the Release PR title format:
The Release PR is squash-merged, and GitHub composes the squash commit from
this title. This repository lints its own commit messages with
commitlint/config-conventional, so the title has to be a Conventional
Commit —Release 0.3.0is a subject our own hooks reject.
The reasoning survives the swap intact — conventional-pre-commit rejects Release 0.3.0 just as firmly — but the sentence names a tool that would no longer be there. Any change here is prek.toml.jinja + ship.yml.jinja + deleting commitlint.config.mjs and the .gitignore entry, and rust.tpl's own prek.toml alongside.
Worth noting there is currently no test tying those four files together: nothing asserts that commitlint.config.mjs exists iff the hook does, or that the node_modules/ ignore is there because of it. See #6.
Not an obvious win, for the record
The two hooks are not identical. @commitlint/config-conventional has a richer rule set — subject case, body line length, footer format — and commitlint.config.mjs is a real extension point if a project ever wants project-specific rules. conventional-pre-commit checks the type/scope/subject grammar and stops. Whether that matters depends on whether anyone has ever wanted the extra rules; my guess is nobody has, but it is your call and not a defect either way.
python.tpl faced the same choice and had a shortcut unavailable here — it already depends on commitizen for the changelog, so cz check on commit-msg was free and uses the same rule set that writes the changelog. Rust has no equivalent, which is why this is a trade rather than a cleanup.
Found while building python.tpl.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with template/prek.toml.jinja:21-28 and rust.tpl's prek.toml:17-24, then review template/ship.yml.jinja:19-23 and the related commitlint.config.mjs and .gitignore entries. Compare the existing commitlint hook with compilerla/conventional-pre-commit and decide whether its narrower checks are acceptable. Done means the selected hook and all tool-specific references are consistent across the templates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, python, rust
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100