Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
iisisrael opened this issue May 30, 2023 · 4 comments
Closed

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

iisisrael opened this issue May 30, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@iisisrael
Copy link
Contributor

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.

@iisisrael iisisrael added the bug Something isn't working label May 30, 2023
@bdovaz
Copy link
Collaborator

bdovaz commented May 30, 2023

Composer was removed when PHPLint was upgraded because it was the only one that used it and it was no longer needed in that case:

https://github.com/oxsecurity/megalinter/pull/2638/files#diff-ec327cc33365f46316d29b37a7ec42324bd935ed7114c8f9ea9c7febf1a10a83

@llaville who is the author of the PHPLint upgrade to v9 commented it, I have no experience in PHP linters so I followed his steps: #2483

cc @nvuillam @echoix @Kurt-von-Laven

@nvuillam
Copy link
Member

nvuillam commented May 30, 2023

@iisisrael I think if you add a previous PRE_COMMAND with apk add composer it should be ok :) (that's how we used to install it before removing it)

@bdovaz > Good catch, thanks for mentioning :)

@iisisrael
Copy link
Contributor Author

Thanks @nvuillam, that works.

@nvuillam
Copy link
Member

nvuillam commented Jun 7, 2023

@iisisrael I'm glad your use case is solved :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants