Contributing
Code structure and coding conventions: see ARCHITECTURE.md. How to run the tests: see the “Testing” section of README.md.
Commit messages: Conventional Commits
The first line of a commit has the form <type>: <description> (in English, imperative mood).
The type decides the next version and the group in CHANGELOG.md:
| Type | Use for | Version bump (while 0.x) | Changelog group |
|---|---|---|---|
feat | A new feature | minor: 0.1.0 → 0.2.0 | Added |
fix | A bug fix | patch: 0.1.0 → 0.1.1 | Fixed |
perf | Faster, less memory | patch | Performance |
refactor | Reorganised code, same behaviour | patch | Changed |
docs | Documentation | patch | Documentation |
test | Tests | patch | Tests |
ci, build | CI, build, dependencies | patch | Build and CI |
chore | Other chores | patch | Other |
- Breaking changes (a changed CLI option, a changed JSON output format, a changed public API):
add
!after the type (feat!: ...) or aBREAKING CHANGE: ...line in the body. - A scope may go in parentheses:
fix(tables): keep header rows at the top of a page. - Examples:
feat: add a batch command,perf: keep embedded JPEGs instead of re-encoding them.
Older commits from before this convention use the form “Add …”, “Fix …”. The changelog still puts them in the right group.
Releases
Every merge into main is a release, and the merged commit is the release commit, except a
PR that changes nothing built or tested. PRs are squash-merged, so the PR title (a Conventional
Commits subject, checked by .github/workflows/pr.yml) is the commit, and it sets the version:
feat → minor, breaking (! before the colon, or BREAKING CHANGE: in the description) → major
(minor while 0.x), anything else → patch.
A PR of kind docs, ci, test, style or chore that is not breaking is not released: it
keeps the version of the last release, has no CHANGELOG.md entry, and its merge makes no tag, no
GitHub release and no package. bump leaves its version as it is. When such a PR must be
published all the same (a docs change to README.md, which crates.io and PyPI show), run
python3 scripts/release.py bump --pr <number> --release.
A PR that is released therefore carries its own version and changelog entry:
-
Open the PR, then run on its branch:
python3 scripts/release.py bump --pr <number>It reads the PR’s title and description with
gh, works out the version from the lastvX.Y.Ztag and the title, writes it intoCargo.tomlandCargo.lock, and writes the entry at the top ofCHANGELOG.md. Commit it (chore(release): vX.Y.Z) and push. Withoutgh:--title "fix(tables): ..." --body-file description.md(a file in the repository or a temporary directory, or-for the standard input). -
Run it again after changing the title or the description: it rewrites the same entry.
-
The PR workflow fails while the version is not the one the title asks for, or
CHANGELOG.mdhas no entry for it. -
On merge,
.github/workflows/release.ymltags the merged commitvX.Y.Zand creates the GitHub release with that entry as notes, then builds the binaries for Linux (x86_64, aarch64), macOS (Apple Silicon, Intel) and Windows (x86_64), with sha256 checksums, attaches them, and publishes the crate. Nothing is committed tomainby the workflow.
Two open PRs cannot both keep the same version: once one is merged, the other has a conflict in
Cargo.toml; update it from main and run bump again.
The PR description is the release note. The entry of a PR is its title followed by its description, cleaned first:
- what is only for reviewers is dropped: a
Summaryheading, theTesting/Tests/Test plan/Verification/Snapshotssections, the “Generated by” footer and trailers; - headings move two levels down.
So write the description for users: what changed and why, with numbers where they help.
Pull requests that only change the documentation
scripts/ci_changes.py decides whether a PR changes anything the build or the tests read. When
it does not, CI (lint, tests, Word fidelity), SonarQube and the Python tests and wheels are
skipped; the “Title and version” check still runs, and such a PR is released unless its kind is
one that is not (above). A PR counts
as documentation only when every file it changes is a Markdown file at the root, a file under
docs/, python/README.md or LICENSE, apart from Cargo.toml and python/pyproject.toml
changed only in their package metadata (version, description, keywords, …) and Cargo.lock
changed only in the version of kakemono. Markdown read by the tests (tests/data/word/*.md) or
next to the code (src/**/README.md) is code.
Code quality: SonarQube Cloud
.github/workflows/sonar.yml sends each push to main and each pull request to SonarQube Cloud,
with the clippy findings (clippy-report.json) and the test coverage from cargo llvm-cov
(lcov.info). Settings are in sonar-project.properties. The job is skipped until the
SONAR_TOKEN secret exists. One-time setup:
- Sign in to sonarcloud.io with GitHub, import the GitHub organization and add this repository as a project.
- In the project, Administration → Analysis Method: turn off Automatic Analysis (the workflow does the analysis; both cannot run at once, and only the workflow imports clippy and coverage).
- My Account → Security: generate a token, and add it to the repository as the GitHub secret
SONAR_TOKEN(Settings → Secrets and variables → Actions). - If SonarQube Cloud gave the organization or project another key than the ones in
sonar-project.properties, change them there.