PHPStan baseline removed before generating a new one from test results

Created on 3 April 2025, 30 days ago

Problem/Motivation

At Migrate Magician, I need to customize PHPStan checks to exclude a certain file (a plugin which extends a migrate plugin of Color module which not yet has a 11-compatible release). I did this by a phpstan-baseline.neon file, added to the root of the project.

Unfortunately, since December 21, my weekly tests are failing, because since then, the pipeline removes the baseline file before it tries to generate a new one (but I guess the reference to this file in phpstan.neon is kept) – making the check to fail: https://git.drupalcode.org/project/migmag/-/jobs/4863776#L57

see https://git.drupalcode.org/project/migmag/-/jobs/4863776

I tried to use a customized baseline file name, got the same result.

Steps to reproduce

Probably it is enough to have a baseline file in the repository.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Component

gitlab-ci

Created by

πŸ‡­πŸ‡ΊHungary huzooka Hungary πŸ‡­πŸ‡ΊπŸ‡ͺπŸ‡Ί

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

Comments & Activities

  • Issue created by @huzooka
  • πŸ‡­πŸ‡ΊHungary huzooka Hungary πŸ‡­πŸ‡ΊπŸ‡ͺπŸ‡Ί

    I also looked at the docs here https://project.pages.drupalcode.org/gitlab_templates/jobs/phpstan, didn't found anything whick made me think my config is not valid anymore.

  • πŸ‡¬πŸ‡§United Kingdom jonathan1055

    Hi huzooka,
    Thanks for reporting this. You say since 21 December, so it is likely that πŸ“Œ Tweak PHPStan config so paths are always correct and baseline is more usable Active has something to do with this, as those changes where made default in version 1.6.11 released on 18 December. Just for verification, would you be able to run a test pipeline using version 1.6.10? You can do this via the pipeline UI form. You need to enter the value for _CURL_TEMPLATES_REF as 1.6.10. This variable is right at the end of the form.

    Can you give a link to this pipeline, then I can check how the processing differs from the later run. Thanks.

  • πŸ‡¬πŸ‡§United Kingdom jonathan1055

    That third call to phpstan uses

    --allow-empty-baseline

    which should allow the baseline file to not exist. At least it did when we tested those changes back then.

    In your committed 1.8.x repo you just have the default phpstan-baseline.neon file, so I was wondering where the custom-phpstan-baseline.neon name came from? Did you set this via pipeline UI variable?

    Looking back through your pipeline history, PHPstan passed '3 months ago' here
    https://git.drupalcode.org/project/migmag/-/jobs/3697585

    Just trying to understand the background of the problem.

  • πŸ‡¬πŸ‡§United Kingdom jonathan1055

    I have replicated your error by using your exact phpstan-baseline.neon file in our Gitlab Templates Downstream testing project. Here is the failing pipeline

    My understanding is that the baseline file usually has just errors to ignore, not other config parameters. These other config parameters usually go in the project's phpstan.neon config file. This may only be a convention of practice, not a rule, but I tried changing the phpstan-baseline.neon file so that it did not contain the excludePaths and the job then passed perfectly! Here is the passing pipeline

    I have opened a new MR on πŸ“Œ Fix testing on most recent Drupal core versions Active to test this in your project.

  • πŸ‡¬πŸ‡§United Kingdom jonathan1055

    Migmag MR13 now correctly runs PHPStan jobs.

    There is still some investigation required as to why your original phpstan-baseline.neon caused the failure.

  • πŸ‡­πŸ‡ΊHungary huzooka Hungary πŸ‡­πŸ‡ΊπŸ‡ͺπŸ‡Ί

    Thank you!

Production build 0.71.5 2024