Skip to content

MLC107: MoveToTarget without generate_target() on any path

qual reports MLC107 when a MoveToTarget(mob) construction is reached and no execution path has called mob.generate_target() (or created an .animate builder, which generates a target) beforehand. Manim validates the target in the constructor and raises ValueError.

  • Default severity: error
  • Minimum confidence: high
  • Implementation phase: 2
  • Fix: none

The verdict comes from the lifecycle abstract interpreter: Absent means absent on all paths. A target generated on only some paths (Maybe) stays silent, as does a scene whose constructor chain could not be resolved.

Wrong

class Demo(Scene):
    def construct(self):
        sq = Square()
        self.add(sq)
        self.play(MoveToTarget(sq))  # no generate_target() anywhere
class Demo(Scene):
    def construct(self):
        sq = Square()
        self.add(sq)
        sq.generate_target()
        sq.target.shift(RIGHT)
        self.play(MoveToTarget(sq))