[CI] Generate full baseline upon PHPStan failure

Created on 31 October 2024, 5 months ago

Problem/Motivation

When a PHPStan job fails for core, a new baseline file artifact is generated. However, that is an incremental one (i.e. contains entries only for the NEW failures).

It would be more helpful to get a full baseline file so to copypaste it in the mr branch as is.

See https://drupal.slack.com/archives/CGKLP028K/p1730242123771039 for some insights.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Feature request
Status

Active

Version

11.0 🔥

Component

base system

Created by

🇮🇹Italy mondrake 🇮🇹

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

Merge Requests

Comments & Activities

  • Issue created by @mondrake
  • 🇮🇹Italy mondrake 🇮🇹
  • Merge request !10903Closes #3484896 → (Open) created by mondrake
  • Pipeline finished with Failed
    3 months ago
    Total: 89s
    #395620
  • Pipeline finished with Failed
    3 months ago
    Total: 147s
    #395630
  • Pipeline finished with Failed
    3 months ago
    Total: 148s
    #395676
  • Pipeline finished with Failed
    3 months ago
    Total: 98s
    #395693
  • Pipeline finished with Failed
    3 months ago
    Total: 82s
    #395706
  • Pipeline finished with Failed
    3 months ago
    Total: 139s
    #395718
  • Pipeline finished with Failed
    3 months ago
    Total: 101s
    #395758
  • Pipeline finished with Failed
    3 months ago
    Total: 86s
    #395763
  • Pipeline finished with Failed
    3 months ago
    Total: 88s
    #395770
  • 🇮🇹Italy mondrake 🇮🇹
  • Pipeline finished with Success
    3 months ago
    Total: 459s
    #395774
  • Pipeline finished with Failed
    3 months ago
    Total: 104s
    #395877
  • Pipeline finished with Failed
    3 months ago
    Total: 95s
    #395881
  • Pipeline finished with Failed
    3 months ago
    Total: 179s
    #395884
  • Pipeline finished with Failed
    3 months ago
    Total: 108s
    #395888
  • Pipeline finished with Failed
    3 months ago
    Total: 90s
    #395897
  • Pipeline finished with Failed
    3 months ago
    Total: 99s
    #395905
  • Pipeline finished with Failed
    3 months ago
    Total: 92s
    #395919
  • Pipeline finished with Failed
    3 months ago
    Total: 89s
    #395931
  • Pipeline finished with Failed
    3 months ago
    Total: 87s
    #395932
  • Pipeline finished with Failed
    3 months ago
    Total: 97s
    #395938
  • Pipeline finished with Failed
    3 months ago
    Total: 123s
    #395940
  • 🇮🇹Italy mondrake 🇮🇹

    After some headache, now found the right regex to have sed adjust the paths of the generated baseline so it can be really just copy/pasted to the branch with no additional edit.

  • Pipeline finished with Success
    3 months ago
    #395946
  • Pipeline finished with Canceled
    3 months ago
    Total: 132s
    #396738
  • Pipeline finished with Failed
    3 months ago
    Total: 146s
    #396741
  • Pipeline finished with Success
    3 months ago
    Total: 2119s
    #397023
  • 🇳🇱Netherlands bbrala Netherlands

    I actually ran into this issue earlier today by chance (the paths not being correct).

    This looks good and will make some things easier, but also allow for a good interface in gitlab for changes as per 📌 [CI] Report PHPStan baseline statistics in job Active .

    All good, working as intended :)

  • The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • 🇮🇹Italy mondrake 🇮🇹

    Please, bot, don't boycott.

  • 🇮🇹Italy mondrake 🇮🇹
  • Pipeline finished with Success
    2 months ago
    Total: 299s
    #400747
  • 🇳🇱Netherlands bbrala Netherlands

    As per Alex, we need a comment there, i understand it feels fragile, unfortunately a result of how things are run.

  • Pipeline finished with Success
    about 1 month ago
    Total: 383s
    #434776
  • Pipeline finished with Success
    about 1 month ago
    Total: 330s
    #434786
  • 🇺🇸United States smustgrave

    Actually just reviewed a ticket that could of used this so perfect timing!

    Believe feedback for a comment has been added so going to mark it.

  • 🇬🇧United Kingdom longwave UK

    I tried to commit this but it's breaking the pre-commit script:

    Running PHPStan on changed files.
     ------ ----------------------------------------------------------------------- 
      Line                                                                          
     ------ ----------------------------------------------------------------------- 
      408    Syntax error, unexpected '"' on line 408                               
      408    Syntax error, unexpected T_STRING on line 408                          
      409    Syntax error, unexpected T_NS_SEPARATOR on line 409                    
      409    Syntax error, unexpected T_STRING on line 409                          
      426    Syntax error, unexpected T_LNUMBER on line 426                         
      450    Syntax error, unexpected T_STRING on line 450                          
      451    Syntax error, unexpected T_STRING on line 451                          
      479    Syntax error, unexpected T_STRING on line 479                          
      480    Syntax error, unexpected T_STRING on line 480                          
      514    Syntax error, unexpected '.' on line 514                               
      555    Syntax error, unexpected T_CONSTANT_ENCAPSED_STRING on line 555        
      555    Syntax error, unexpected T_STRING on line 555                          
      556    Syntax error, unexpected T_CONSTANT_ENCAPSED_STRING on line 556        
      556    Syntax error, unexpected T_STRING on line 556                          
      557    Syntax error, unexpected '"', expecting '-' or T_STRING or T_VARIABLE  
             or T_NUM_STRING on line 557                                            
      557    Syntax error, unexpected T_STRING, expecting T_VARIABLE or             
             T_ENCAPSED_AND_WHITESPACE or T_DOLLAR_OPEN_CURLY_BRACES or             
             T_CURLY_OPEN on line 557                                               
    

    I think because line 406 has the PHP open tag:

            echo "<?php return [];" > ./core/.phpstan-baseline.php
    

    then PHPStan tries to interpret the YAML as PHP and it all goes wrong. Either we need to tell PHPStan to ignore this file, or remove the open tag, or break it up into two parts so PHPStan can't see it?

  • 🇮🇹Italy mondrake 🇮🇹

    Why on earth is that script trying to have PHPStan scan .gitlab-ci.yml?

    Is core/scripts/dev/commit-code-check.sh the culprit? If it is, then it's probably because if PHPStan is passed a list of file paths, it's skipping the file discovery based on its configuration and just scan them all. So that script need change to only pass files with php/module/inc/etc. extensions.

  • 🇮🇹Italy mondrake 🇮🇹

    OK, let's revert to prior https://git.drupalcode.org/project/drupal/-/merge_requests/10903/diffs?c... and see if that could fit.

  • 🇮🇹Italy mondrake 🇮🇹
  • Pipeline finished with Success
    27 days ago
    Total: 1124s
    #441771
  • Status changed to RTBC 13 days ago
  • 🇺🇸United States smustgrave

    With all the recent rebasing people have to do around the baseline it would be nice to get this one in please :)

  • Pipeline finished with Failed
    11 days ago
    Total: 641s
    #454978
  • Pipeline finished with Success
    9 days ago
    Total: 471s
    #456468
  • Pipeline finished with Success
    1 day ago
    Total: 509s
    #462192
Production build 0.71.5 2024