MLR116: add_line_to/close_path on a provably empty path¶
qual reports MLR116 when add_line_to or close_path is
called on a VMobject whose own path is provably empty at that point.
- Default severity:
error - Minimum confidence:
high - Implementation phase:
2 - Fix: none (suggests
start_new_pathfirst)
Both methods read existing points before appending
(vectorized_mobject.py): add_line_to extends the current curve from
points[-1] and close_path connects back to points[0], so on an
empty path either raises IndexError the moment the scene renders. A
fresh VMobject() / VGroup() starts empty (as does clear_points()),
and the abstract interpreter tracks the exact point count through the
path-construction methods.
The rule fires only when emptiness is proven on every path to the call.
A branch-dependent start_new_path, an unknown point count (e.g. a
project subclass whose __init__ may build a path), or a non-empty
curated constructor (Square(), Line(), ...) all stay silent.
Wrong:
Right: