Skip to content

Refactor: decompose the 4 relocated mega-functions (_type_check_params, _set_color_source_vec, _get_collection_shape, _convert_shapes) #716

@timtreis

Description

@timtreis

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions