Skip to content

Commit e8bdcb0

Browse files
committed
Enforce alphabetical sorting in typos.toml and tweak comments
1 parent 8238fa6 commit e8bdcb0

2 files changed

Lines changed: 29 additions & 13 deletions

File tree

src/tools/tidy/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ fn main() {
3232
let npm: PathBuf = env::args_os().nth(5).expect("need name/path of npm command").into();
3333

3434
let root_manifest = root_path.join("Cargo.toml");
35+
let typos_toml = root_path.join("typos.toml");
3536
let src_path = root_path.join("src");
3637
let tests_path = root_path.join("tests");
3738
let library_path = root_path.join("library");
@@ -143,6 +144,7 @@ fn main() {
143144
check!(edition, &library_path);
144145

145146
check!(alphabetical, &root_manifest);
147+
check!(alphabetical, &typos_toml);
146148
check!(alphabetical, &src_path);
147149
check!(alphabetical, &tests_path);
148150
check!(alphabetical, &compiler_path);

typos.toml

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Config for the `typos` crate, used by `./x test tidy --extra-checks=spellcheck`.
2+
# See also: https://github.com/crate-ci/typos/blob/v1.28.2/docs/reference.md
3+
14
[files]
25
extend-exclude = [
36
# exclude git (sub)modules and generated content
@@ -13,9 +16,10 @@ extend-exclude = [
1316
]
1417

1518
[default.extend-words]
16-
# Add exclusions here, lines should be like `x = "x"`, where `x` is excluded word.
19+
# Allowlist for words that look like typos but are not, or aren't worth fixing
20+
# right now. Entries should look like `mipsel = "mipsel"`.
1721
#
18-
# Also see docs: https://github.com/crate-ci/typos/blob/v1.28.2/docs/reference.md
22+
# tidy-alphabetical-start
1923
arange = "arange"
2024
childs = "childs"
2125
clonable = "clonable"
@@ -24,6 +28,7 @@ leafs = "leafs"
2428
makro = "makro"
2529
misformed = "misformed"
2630
moreso = "moreso"
31+
numer = "numer"
2732
optin = "optin"
2833
publically = "publically"
2934
rplace = "rplace"
@@ -33,33 +38,42 @@ targetting = "targetting"
3338
unparseable = "unparseable"
3439
unstability = "unstability"
3540
unstalled = "unstalled"
36-
numer = "numer"
41+
# tidy-alphabetical-end
42+
43+
# Denylist to forbid misspelled words that aren't detected by the built-in
44+
# dictionary. Entries should look like `mipsel = ""` or `mipsel = "misspell"`;
45+
# the non-empty form can be automatically fixed by `--bless`.
46+
#
47+
# tidy-alphabetical-start
48+
# tidy-alphabetical-end
3749

3850
[default.extend-identifiers]
39-
# An entry goes here if the typo is part of some existing ident
40-
# where you want to keep it, but don't want to allow
41-
# such typos everywhere.
51+
# Allowlist for specific identifiers that should be permitted even though they
52+
# appear to contain typos that would be forbidden in other identifiers.
4253
#
43-
# I.e. you don't want (or can't) fix some constant name, like
44-
# `DNS_ERROR_INVAILD_VIRTUALIZATION_INSTANCE_NAME` but actually
45-
# want to see `INVAILD` typo fixed in other places.
46-
debug_aranges = "debug_aranges"
54+
# For example, you might want to allow a specific constant like
55+
# `DNS_ERROR_INVAILD_VIRTUALIZATION_INSTANCE_NAME`, but still want to forbid
56+
# the typo `INVAILD` in other places.
57+
#
58+
# tidy-alphabetical-start
4759
DNS_ERROR_INVAILD_VIRTUALIZATION_INSTANCE_NAME = "DNS_ERROR_INVAILD_VIRTUALIZATION_INSTANCE_NAME"
48-
EnzymeTypeTreeShiftIndiciesEq = "EnzymeTypeTreeShiftIndiciesEq"
49-
EnzymeTypeTreeShiftIndiciesEqFn = "EnzymeTypeTreeShiftIndiciesEqFn"
50-
shift_indicies_eq = "shift_indicies_eq"
5160
ERRNO_ACCES = "ERRNO_ACCES"
5261
ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS = "ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS"
5362
ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC = "ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC"
5463
ERROR_FILENAME_EXCED_RANGE = "ERROR_FILENAME_EXCED_RANGE"
5564
ERROR_MCA_OCCURED = "ERROR_MCA_OCCURED"
5665
ERROR_REQ_NOT_ACCEP = "ERROR_REQ_NOT_ACCEP"
66+
EnzymeTypeTreeShiftIndiciesEq = "EnzymeTypeTreeShiftIndiciesEq"
67+
EnzymeTypeTreeShiftIndiciesEqFn = "EnzymeTypeTreeShiftIndiciesEqFn"
5768
Oppen = "Oppen"
5869
# typos treats this as two different camelcase words (`SETTIN` and `Gs`)
5970
# Tracked in: https://github.com/crate-ci/typos/issues/745
6071
SETTINGs = "SETTINGs"
72+
debug_aranges = "debug_aranges"
6173
key_smove = "key_smove" # shifted move key, used by terminfo
74+
shift_indicies_eq = "shift_indicies_eq"
6275
tolen = "tolen"
76+
# tidy-alphabetical-end
6377

6478
[default]
6579
extend-ignore-words-re = [

0 commit comments

Comments
 (0)