Skip to content

[maintainability] One-third of src/ is comments, with several 12+ line docblocks explaining past review decisions rather than the code #65

Description

@corgab

Summary

Confirmed by direct count: src/ totals 5073 lines, of which 1690 (~33%) are comment lines (^\s*(\*|//|/\*)). Several docblocks run well past what a plain narrative comment needs, and read as records of a past design discussion rather than documentation a future reader needs to use the code correctly. The clearest example: AbstractQuantumDriver::preflight()'s docblock (13 lines) spends its entire length explaining that asynchronous paths must not call this method and why — information a more precise name (e.g. preflightSynchronous()) would convey in the call site itself, with no docblock required.

Where (docblocks of 12+ lines, a non-exhaustive sample)

  • src/Drivers/AbstractQuantumDriver.php:84-96 (preflight() — 13 lines explaining a naming/scoping decision)
  • src/Testing/QuantumFake.php:25-45 (class docblock — extensive Http::fake()-parity rationale)
  • src/Models/QuantumTask.php:11-24 (property-annotation docblock — largely standard Eloquent @property documentation, arguably not part of this concern)
  • src/Circuit/Gate.php:295-310 (measure() docblock)
  • src/Drivers/AwsBraketDriver.php:96-112 (assertWithinCostCeiling() docblock)
  • src/Drivers/LocalSimulatorDriver.php:15-33 (class docblock)

Refactor proposal

This is a genuine but low-severity, largely subjective cleanup opportunity, not a functional defect — treat it as a standing low-priority "epic" rather than a single fix. Where a docblock exists primarily to explain a naming/scoping choice (like preflight()), prefer renaming over documenting the constraint. Where a docblock explains why (a design tradeoff, a past bug it guards against), keep it — that is exactly what comments are for and several examples above (e.g. QuantumFake's Http::fake()-parity rationale) do that well. Audit case by case rather than trimming uniformly.

Severity: low

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions