Commit 5b6e265
fix(compile): address codemod-refactor PR review
Two findings + two suggestions from the latest Rust PR Reviewer pass:
1. Naming clash in `perform_source_rewrite_if_needed`: the
parameter `codemods: &codemods::CodemodReport` shadowed the
sibling `codemods` module. Functionally fine (the module isn't
used inside the function body) but a future caller adding a
`codemods::something()` reference would hit a confusing type
error. Renamed to `report`.
2. `docs/codemods.md` claimed "Front-matter key order is preserved"
without qualification. Renamed keys move to the END of the
front-matter block because `Mapping::insert` appends new keys
when absent. Updated the doc to call this out, and added the
same note to the stderr warning emitted when codemods rewrite
the source.
3. Marked the two registry-health tests
(`registry_ids_are_unique`, `codemod_filenames_match_registry_count`)
as vacuously true while CODEMODS is empty, so future reviewers
don't mistake the green test for a meaningful invariant today.
4. Added a comment on the `pub use helpers::*` re-export and on
the helper-level `#[allow(dead_code)]`s explaining they're
defensive against the empty-registry warning surface and should
be stripped once the first real codemod lands.
Plus, while in the docs, added an "unsanitized input" invariant
to the codemod author contract: the runner sanitizes the typed
`FrontMatter` AFTER codemods run, so the raw `Mapping` codemods
receive is whatever the user wrote. Codemods should treat values
as opaque rather than parse/interpolate them.
All 1349 tests pass. No behavior changes outside the docs and the
warning text.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent c8cec49 commit 5b6e265
3 files changed
Lines changed: 34 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
48 | 53 | | |
49 | 54 | | |
50 | 55 | | |
| |||
191 | 196 | | |
192 | 197 | | |
193 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
194 | 208 | | |
195 | 209 | | |
196 | 210 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
36 | 43 | | |
37 | 44 | | |
38 | 45 | | |
| |||
159 | 166 | | |
160 | 167 | | |
161 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
162 | 172 | | |
163 | 173 | | |
164 | 174 | | |
| |||
171 | 181 | | |
172 | 182 | | |
173 | 183 | | |
174 | | - | |
175 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
176 | 188 | | |
177 | 189 | | |
178 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
| 266 | + | |
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| |||
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
306 | | - | |
| 306 | + | |
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
310 | | - | |
| 310 | + | |
| 311 | + | |
311 | 312 | | |
312 | 313 | | |
313 | 314 | | |
| |||
0 commit comments