ComposerInspector::validateProject() passes unnecessary flags to `composer validate`

Created on 25 April 2023, over 1 year ago
Updated 3 May 2023, over 1 year ago

Problem/Motivation

ComposerInspector::validateProject() passes many flags to composer validate, including: --ansi --no-interaction --no-cache. This makes no sense. Let's examine why:

--ansi enables ANSI mode, which allows for things like coloring and text styling on the terminal. However, we never display the output of Composer on the terminal -- Drupal is a web app. So the ANSI mode gains us nothing, and in fact, as #3354594-8: Merge ComposerSettingsValidator into ComposerValidator shows, it breaks us in some situations.

--no-interaction prevents interaction, but composer validate is not an interactive command anyway. So there's no point to that.

--no-cache prevents use of the cache for installing packages. But composer validate is a read-only command that doesn't install or update any packages. It's pointless.

Proposed resolution

Change ComposerInspector::validateProject() so that it only passes the following, relevant flags: --check-lock --no-check-publish --with-dependencies --no-ansi --working-dir.

This is very internal refactoring that, IMHO, does not need dedicated test coverage in this issue.

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇺🇸United States phenaproxima Massachusetts

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024