Finding
A radon cc scan of src/chilmesh reports eleven functions at rank D or E (complexity 21 or higher). Ranked worst first:
| Rank |
Complexity |
Location |
| E |
36 |
gmsh_io._read_msh_v4_1 |
| E |
34 |
fort14_io.read_fort14_raw |
| E |
32 |
_vendor_admesh_truss.distmesh2d_warmstart |
| D |
26 |
fort13_io.read_fort13 |
| D |
25 |
gmsh_io._read_msh_v2_2 |
| D |
24 |
CHILmesh.direct_smoother |
| D |
22 |
CHILmesh.read_from_fort14 |
| D |
22 |
mutations.MutableMesh.collapse_edge |
| D |
22 |
summary_io._summary_from_file |
| D |
21 |
mutations.MutableMesh.repeel_local |
| D |
21 |
write_fort14 |
The pattern is consistent: the format readers each parse a header, then a nodes block, then an elements block, then an optional boundary block, all inline in one function with interleaved validation. That is why each reader also accumulates unused-variable warnings — several int(...) parses exist purely to raise ValueError for the surrounding except to convert into a GmshParseError, so the assigned name is never read.
Why this is not a mechanical fix
Splitting a reader into per-section helpers changes where exceptions originate and which partial state is visible at each failure point. Since fort.14 round-trip fidelity is a hard compatibility constraint, any split needs round-trip tests over the full fixture corpus to prove byte-identical output before and after, not just a green unit suite.
Suggested approach
Take one function at a time, highest complexity first, and for each:
- Extract the per-section parse into a private helper that raises the same error type.
- Give the helper direct tests, including malformed-input cases.
- Confirm round-trip identity on all four fixtures (annulus, donut, block_o, structured) plus the fort.14 reference corpus.
_vendor_admesh_truss.distmesh2d_warmstart should be left alone — it is a vendored copy and should track upstream rather than diverge.
Scope guard
No change to _skeletonize() behavior, public API signatures, fort.14 I/O semantics, or adjacency invariants.
[model: claude-opus, repo: CHILmesh, session: dev-cleanup sweep]
Finding
A
radon ccscan ofsrc/chilmeshreports eleven functions at rank D or E (complexity 21 or higher). Ranked worst first:gmsh_io._read_msh_v4_1fort14_io.read_fort14_raw_vendor_admesh_truss.distmesh2d_warmstartfort13_io.read_fort13gmsh_io._read_msh_v2_2CHILmesh.direct_smootherCHILmesh.read_from_fort14mutations.MutableMesh.collapse_edgesummary_io._summary_from_filemutations.MutableMesh.repeel_localwrite_fort14The pattern is consistent: the format readers each parse a header, then a nodes block, then an elements block, then an optional boundary block, all inline in one function with interleaved validation. That is why each reader also accumulates unused-variable warnings — several
int(...)parses exist purely to raiseValueErrorfor the surroundingexceptto convert into aGmshParseError, so the assigned name is never read.Why this is not a mechanical fix
Splitting a reader into per-section helpers changes where exceptions originate and which partial state is visible at each failure point. Since fort.14 round-trip fidelity is a hard compatibility constraint, any split needs round-trip tests over the full fixture corpus to prove byte-identical output before and after, not just a green unit suite.
Suggested approach
Take one function at a time, highest complexity first, and for each:
_vendor_admesh_truss.distmesh2d_warmstartshould be left alone — it is a vendored copy and should track upstream rather than diverge.Scope guard
No change to
_skeletonize()behavior, public API signatures, fort.14 I/O semantics, or adjacency invariants.[model: claude-opus, repo: CHILmesh, session: dev-cleanup sweep]