chore: Use `committed` instead of `conventional-pre-commit`

The most important difference in this PR is that we now enforce scope
and subject line length. `conventional-pre-commit`, which we have been
using until now, does not appear to allow that unlike `committed` which
we will be now using.

On the other hand, `committed` doesn't allow to require having a scope,
unlike `conventional-pre-commit`, but I will probably submit them a PR
for this later.

I also find it questionable that disabling particular checks is to be
done by switching boolean options to false. Doing so by string options
would be more future-proof.

Also note that this has a check to make sure the commit message starts
with a verb. I am fine with this myself, but it may be an overkill.
This commit is contained in:
Mikolaj Wielgus 2025-04-18 22:06:08 +02:00 committed by mikolaj
parent b000f2b7d8
commit 594bb51a57
3 changed files with 78 additions and 4 deletions

View File

@ -14,9 +14,8 @@ repos:
rev: v5.0.2
hooks:
- id: reuse-lint-file
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.4.0
- repo: https://github.com/crate-ci/committed
rev: v1.1.7
hooks:
- id: conventional-pre-commit
- id: committed
stages: [commit-msg]
args: []

View File

@ -9,6 +9,8 @@ steps:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
commands:
- cargo install committed
- committed develop..HEAD
- rustup component add rustfmt
- cargo fmt --all -- --check
when:

73
committed.toml Normal file
View File

@ -0,0 +1,73 @@
# SPDX-FileCopyrightText: 2025 Topola contributors
#
# SPDX-License-Identifier: MIT
subject_length = 80
line_length = 100
style = "conventional"
# Should be the same as the list of directories in crates/ and src/.
allowed_scopes = [
# Generated using `ls crates | awk '{ print "\"" $1 "\","; }' | sort`.
"planar-incr-embed",
"specctra-core",
"specctra_derive",
"topola-cli",
"topola-egui",
# Generated using
# `find src -type f | awk '!/lib.rs|mod.rs/ { print "\"" substr($1, 1 + 4, length($1) - 4 - 3) "\","; }' | sort`.
"autorouter/autoroute",
"autorouter/autorouter",
"autorouter/compare_detours",
"autorouter/execution",
"autorouter/history",
"autorouter/invoker",
"autorouter/measure_length",
"autorouter/place_via",
"autorouter/pointroute",
"autorouter/ratsnest",
"autorouter/remove_bands",
"autorouter/selection",
"drawing/band",
"drawing/bend",
"drawing/cane",
"drawing/collect",
"drawing/dot",
"drawing/drawing",
"drawing/gear",
"drawing/graph",
"drawing/guide",
"drawing/head",
"drawing/loose",
"drawing/primitive",
"drawing/seg",
"geometry/compound",
"geometry/edit",
"geometry/geometry",
"geometry/poly",
"geometry/primitive",
"geometry/recording_with_rtree",
"geometry/shape",
"geometry/with_rtree",
"graph",
"interactor/activity",
"interactor/interaction",
"interactor/interactor",
"layout/layout",
"layout/poly",
"layout/via",
"math/tangents",
"router/astar",
"router/draw",
"router/navcord",
"router/navcorder",
"router/navmesh",
"router/route",
"router/router",
"specctra/design",
"stepper",
"triangulation"
]
merge_commit = false