Skip to content

Commit 0e9d760

Browse files
lorenzleutgebFintanH
authored andcommitted
hooks: Enable typos, fix reported errors
1 parent 5fa68ed commit 0e9d760

File tree

6 files changed

+30
-7
lines changed

6 files changed

+30
-7
lines changed

.codespellrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[codespell]
2-
skip = .git*,*.lock,.codespellrc
2+
skip = .git*,*.lock,.codespellrc,target,.jj
33
check-hidden = true
4-
ignore-words-list = ser,noes
4+
ignore-words-list = set,noes

.typos.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[default]
2+
extend-ignore-re = [
3+
"[0-9a-f]{7}\\.\\.\\.?[0-9a-f]{7}", # Git range between two short commit IDs
4+
"[0-9a-f]{7}\\[\\.\\.\\]", # Shortened commit IDs as written in tests
5+
"did:key:z6Mk[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{44}",
6+
"rad://z[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{28}",
7+
"rad:z[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{28}",
8+
"z6Mk[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{44}",
9+
]
10+
11+
[default.extend-identifiers]
12+
"typ" = "typ" # We may write "typ" instead of "type". The latter is a Rust keyword.
13+
14+
[type.codespell]
15+
check-file = false
16+
extend-glob = [".codespellrc"]

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
3131
// x.y.z, with efe10f95be being a unique prefix of the OID of
3232
// `HEAD`, and the working directory was dirty.
3333
// If this is a build pointing to a commit that has release tag, this
34-
// will just return the tag name itelf, e.g. `releases/x.y.z`.
34+
// will just return the tag name itself, e.g. `releases/x.y.z`.
3535
// If all fails, we just use `hash`, which, in the worst case is
3636
// still "unknown" (see above) but in most cases will just be
3737
// the short OID of `HEAD`.

crates/radicle-protocol/src/service/limiter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ mod test {
156156
}
157157

158158
#[test]
159-
fn test_limitter_refill() {
159+
fn test_limiter_refill() {
160160
let mut r = RateLimiter::default();
161161
let t = (3, 0.2); // Three tokens burst. One token every 5 seconds.
162162
let a = HostName::Dns(String::from("seed.radicle.example.com"));
@@ -188,7 +188,7 @@ mod test {
188188

189189
#[test]
190190
#[rustfmt::skip]
191-
fn test_limitter_multi() {
191+
fn test_limiter_multi() {
192192
let t = (1, 1.0); // One token per second. One token burst.
193193
let n = arbitrary::gen::<NodeId>(1);
194194
let n = Some(&n);
@@ -208,7 +208,7 @@ mod test {
208208

209209
#[test]
210210
#[rustfmt::skip]
211-
fn test_limitter_different_rates() {
211+
fn test_limiter_different_rates() {
212212
let t1 = (1, 1.0); // One token per second. One token burst.
213213
let t2 = (2, 2.0); // Two tokens per second. Two token burst.
214214
let n = arbitrary::gen::<NodeId>(1);

crates/radicle-ssh/src/encoding.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub trait Encoding {
5656
/// May panic if the argument is greater than [`u32::MAX`].
5757
/// This is a convenience method, to spare callers casting or converting
5858
/// [`usize`] to [`u32`]. If callers end up in a situation where they
59-
/// need to push a 32-bit unisgned integer, but the value they would
59+
/// need to push a 32-bit unsigned integer, but the value they would
6060
/// like to push does not fit 32 bits, then the implementation will not
6161
/// comply with the SSH format anyway.
6262
fn extend_usize(&mut self, u: usize) {

flake.nix

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,13 @@
235235
hooks =
236236
{
237237
alejandra.enable = true;
238+
typos = {
239+
enable = true;
240+
settings = {
241+
verbose = true;
242+
write = true;
243+
};
244+
};
238245
codespell = {
239246
enable = true;
240247
entry = "${lib.getExe pkgs.codespell} -w";

0 commit comments

Comments
 (0)