Follow-up to #696 (split utils.py), which explicitly deferred this:
The two mega-functions being relocated … are themselves decomposition candidates, but that is out of scope here … Decomposition can follow once each lives in a smaller, single-concern file.
Now that #696/#715 puts each in its own module, decompose them. Current lizard metrics (NLOC / CCN / length):
| function | module | NLOC | CCN | length |
|---|
_type_check_params | _validate.py | 291 | 164 | 372 |
_set_color_source_vec | _color.py | 196 | 49 | 236 |
_get_collection_shape | _geometry.py | 91 | 39 | 144 |
_convert_shapes | _geometry.py | 102 | 22 | 176 |
Approach
- One function per PR, each its own bisectable commit.
_type_check_params is a flat, sequential per-parameter validator → decompose into in-order per-parameter check helpers. Behavior-preserving constraint: preserve the exact validation order so the first-raised error is identical for any input. Fully covered by the local non-visual suite — lowest risk, do first._set_color_source_vec, _get_collection_shape, _convert_shapes produce rendering output → their only behavioral net is the CI visual baselines. Decompose carefully and require a green CI visual run before merge.
Risk
Unlike #696 (verbatim moves), this restructures real logic → behavior-change risk. Keep diffs small and per-function so regressions are easy to bisect/revert.
Follow-up to #696 (split
utils.py), which explicitly deferred this:Now that #696/#715 puts each in its own module, decompose them. Current
lizardmetrics (NLOC / CCN / length):_type_check_params_validate.py_set_color_source_vec_color.py_get_collection_shape_geometry.py_convert_shapes_geometry.pyApproach
_type_check_paramsis a flat, sequential per-parameter validator → decompose into in-order per-parameter check helpers. Behavior-preserving constraint: preserve the exact validation order so the first-raised error is identical for any input. Fully covered by the local non-visual suite — lowest risk, do first._set_color_source_vec,_get_collection_shape,_convert_shapesproduce rendering output → their only behavioral net is the CI visual baselines. Decompose carefully and require a green CI visual run before merge.Risk
Unlike #696 (verbatim moves), this restructures real logic → behavior-change risk. Keep diffs small and per-function so regressions are easy to bisect/revert.