Skip to content

Commit 5603ba3

Browse files
chore(rust): add canonical project checker templates
Add the derive, documentation-width, and test-naming checker exemplars to the shared Rust template and propagate executable byte-identical copies to every Rust project;
1 parent f88132d commit 5603ba3

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎scripts/check_derives.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#! /usr/bin/env python3
12
"""
23
Verify DERIVE_LAYOUT: multi-trait `#[derive(...)]` macros must be split
34
into separate single-trait lines, ordered alphabetically by trait name,

‎scripts/check_doc_76.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#! /usr/bin/env python3
12
"""
23
Verify DOC_76: public documentation comment lines are at most 76 characters.
34

‎scripts/check_test_names.py‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#! /usr/bin/env python3
12
"""
23
Verify RUST_TEST_NAMING: test functions and test modules use TEST_ prefix
34
and SHOUTING_SNAKE_CASE, except words that name a specific Rust construct
@@ -43,8 +44,8 @@ def atom_violation(atom: str) -> str | None:
4344
return None
4445

4546
return (
46-
f"segment '{atom}' must be SHOUTING_SNAKE_CASE, a PascalCase construct name, "
47-
"or a Rust snake_case identifier"
47+
f"segment '{atom}' must be SHOUTING_SNAKE_CASE, a PascalCase construct "
48+
"name, or a Rust snake_case identifier"
4849
)
4950

5051

@@ -58,7 +59,7 @@ def parse_padded_construct(
5859
while i < len(segments) and not segments[i]:
5960
i += 1
6061
if i >= len(segments):
61-
return None, i, [f"empty segment padding without construct"]
62+
return None, i, ["empty segment padding without construct"]
6263

6364
seg = segments[i]
6465
atom: str | None = None
@@ -82,7 +83,7 @@ def parse_padded_construct(
8283
violations.append(reason)
8384
i += 1
8485
else:
85-
return None, start, [f"empty segment padding without construct"]
86+
return None, start, ["empty segment padding without construct"]
8687

8788
while i < len(segments) and not segments[i]:
8889
i += 1
@@ -144,8 +145,8 @@ def parse_name_atoms(rest: str) -> tuple[list[str], list[str]]:
144145
continue
145146

146147
violations.append(
147-
f"segment '{seg}' must be SHOUTING_SNAKE_CASE, a PascalCase construct name, "
148-
"or a Rust snake_case identifier"
148+
f"segment '{seg}' must be SHOUTING_SNAKE_CASE, a PascalCase construct "
149+
"name, or a Rust snake_case identifier"
149150
)
150151
i += 1
151152

0 commit comments

Comments
 (0)