When only deprecations that get removed from 12 are left, allow info.yml update

Created on 29 May 2024, 10 months ago
Updated 13 June 2024, 10 months ago

Problem/Motivation

When only deprecations are left that target not next major but after that (12 in this case). The info.yml should be updated to support 11. This is not the case, see parent issue.

Steps to reproduce

Have a pre-rector and post-rector with only d12 issues left. No info yml is updated because there are errors left, but it should.

Proposed resolution

Update code that handles that logic.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Component

Code

Created by

πŸ‡³πŸ‡±Netherlands bbrala Netherlands

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

Comments & Activities

  • Issue created by @bbrala
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Might be as simple as "filtering out" all error elements which remove from deprecated majorr +2 here:

    UpdateStatusXmlChecker:
      public function isInfoUpdatable(): bool {
      }
      public function isComposerUpdatable(): bool { 
      }
    

    if we filter them out here it before checking counts it should ebe fine.

    if (count($this->xml->file) > 2)
    

    Is also wrong i think, we need to match the error regarding the info.yaml so we have a real count. Or have a count of all errors that are not composer of info.yml related?

  • πŸ‡­πŸ‡ΊHungary GΓ‘bor Hojtsy Hungary

    Should we add a drush filter argument to Upgrade Status that project analysis can use? Upgrade Status already deemphasizes future deprecations. This code https://git.drupalcode.org/project/upgrade_status/-/blob/4.x/src/Depreca...

        // If the deprecation is already for after the next Drupal major, put it in the
        // ignore category. This overwrites any categorization before intentionally.
        if (preg_match('!(will be|is) removed (before|from) [Dd]rupal[ :](\d+)\.!', $error, $version_removed)) {
          if ($version_removed[3] > ProjectCollector::getDrupalCoreMajorVersion() + 1) {
            $category = 'ignore';
          }
        }
    

    We could add a filter option to the drush command to filter the ignore category.

  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    That would be great, since the infra is already available there we should use that.

  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Hmm, it is already communicated in severity so the info is already available. Think i just need to refactor the logic.

    $errorCount = x
    $infoErrorCount = array_filter((array) $xml->file, function($file) { return $file['severity'] === 'info'; });
    $infoYamlErrorCount = $this->errorsContainInfoYml() // refactor this method to return a count.
    $composerJsonErrorCount = $this->errorsContainComposerJson() // refactor this method to return a count.
    

    Then:

    1. info.yml is updatable if: errorCount == sum of above && $infoYamlErrorcount > 0
    2. composer.json is updateable if errorCount == sum of above && $composerJsonErrorCount > 0
    3. run rector if => same logic as before, any php files.

    Think that would be fine, and seems to be not that much extra complexity.

  • Status changed to Needs review 10 months ago
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Pushed to a branch in the project itself. Oops.

    Anyways, mr is here:
    https://git.drupalcode.org/project/project_analysis/-/merge_requests/30/pipelines

  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Tests and tesrun prove this allows for patches when d12 is in the deprecations. Also multiple instances of info.yml and composer.json are now handled correctly. Ex0ect a surge in patches.

    • bbrala β†’ committed 01f5ac82 on master-d11
      Issue #3450581: Add checks for error counts. Multiple info.yml is fine,...
  • Status changed to Fixed 10 months ago
  • πŸ‡­πŸ‡ΊHungary GΓ‘bor Hojtsy Hungary

    Fixed then? :)

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024