Skip to content

Composer no longer available for PRE_COMMANDS in v7.0.x #2702

@iisisrael

Description

@iisisrael

Describe the bug
Vendor packages need to be installed for PHPStan to analyze use of injected dependencies, and a composer install pre-command fails with a command not found error in v7.0.x.

To Reproduce
Steps to reproduce the behavior:

  1. Configure a PRE_COMMAND in .mega-linter.yml
PRE_COMMANDS:
  - command: composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts --ignore-platform-req=ext-sockets --ignore-platform-req=ext-intl --ignore-platform-req=ext-fileinfo --ignore-platform-req=ext-sodium --ignore-platform-req=ext-posix --ignore-platform-req=ext-gd --ignore-platform-req=ext-xml
    cwd: "workspace"
  1. Run version 7: npx mega-linter-runner -r v7.0.3
  2. Note the output:
The MegaLinter documentation can be found at:
 - https://megalinter.io/7.0.3
----------------------------------------------------------------------------------------------------
MegaLinter initialization
MegaLinter will analyze workspace [/tmp/lint]

[Pre] run: [composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts --ignore-platform-req=ext-sockets --ignore-platform-req=ext-intl --ignore-platform-req=ext-fileinfo --ignore-platform-req=ext-sodium --ignore-platform-req=ext-posix --ignore-platform-req=ext-gd --ignore-platform-req=ext-xml] in cwd [/tmp/lint]
[Pre] error:
/bin/bash: line 1: composer: command not found
  1. Repeat on verson 6: npx mega-linter-runner -r v6.22.2
  2. Note the output:
The MegaLinter documentation can be found at:
 - https://megalinter.io/6.22.2
----------------------------------------------------------------------------------------------------
MegaLinter initialization

[Pre] run: [composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts --ignore-platform-req=ext-sockets --ignore-platform-req=ext-intl --ignore-platform-req=ext-fileinfo --ignore-platform-req=ext-sodium --ignore-platform-req=ext-posix --ignore-platform-req=ext-gd --ignore-platform-req=ext-xml] in cwd [/tmp/lint]
[Pre] Installing dependencies from lock file (including require-dev)

Expected behavior
Composer should install vendor packages on a pre-command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions