Skip to content

[maintainability] AetherInstallCommand is a 255-line command doing six unrelated jobs, with a duplicated hardcoded path #60

Description

@corgab

Summary

AetherInstallCommand (255 lines) mixes six distinct responsibilities in one class: publishing config, checking the Python interpreter, checking Python dependencies, creating a venv and installing into it, suggesting a .gitignore entry, and running a smoke-test circuit. It constructs 4 separate Symfony\Component\Process\Process instances by hand across these responsibilities (checkPython(), checkDependencies(), and two inside createVenv()), and hardcodes the path to bin/python/requirements.txt twice via __DIR__.'/../../bin/python/requirements.txt' — once in createVenv(), once in showManualInstructions().

Where

  • src/Commands/AetherInstallCommand.php:1-255 (whole file — 6 responsibilities: publishConfig(), checkPython(), checkDependencies()/handleMissingDependencies(), createVenv(), suggestGitignore(), runTestCircuit())
  • new Process(...) at lines 86, 110, 202, 209 (4 instances, not the "6" an earlier pass at this review estimated)
  • $requirementsPath = __DIR__.'/../../bin/python/requirements.txt'; duplicated at lines 199 and 232

Refactor proposal

Extract a PythonEnvironmentInspector (or similar) collaborator owning checkPython(), checkDependencies(), and createVenv() — the pieces that actually shell out to a Python interpreter — leaving AetherInstallCommand to orchestrate calling it plus the unrelated config-publishing/gitignore/smoke-test steps. Move the requirements.txt path resolution into one constant or method on that inspector so it is computed once.

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