Problem/Motivation

#1848264: Compare and merge PhpWiki diff*.php with MediaWiki's DairikiDiff.php and DiffEngine.php has been closed and there is an @todo for it that can be removed. However there does remain remnants of DiffEngine which still do not pass coding standards.

Steps to reproduce

Proposed resolution

1/ Remove this from phpcs.xml.dist:

<!-- @todo This rule may be removed when https://www.drupal.org/node/1848264 is resolved. -->

Remaining tasks

  • Merge request

User interface changes

API changes

DiffFormatter.php has three public properties which change.

show_header -> $showHeader
leading_context_lines -> $leadingContextLines
trailing_context_lines -> $trailingContextLines
line_stats -> $lineStats

Data model changes

Release notes snippet

Issue fork drupal-3346401

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

quietone created an issue. See original summary.

dineshkumarbollu made their first commit to this issue’s fork.

dineshkumarbollu’s picture

Assigned: Unassigned » dineshkumarbollu

Hi

I am working on it.

dineshkumarbollu’s picture

Assigned: dineshkumarbollu » Unassigned
Status: Active » Needs review
spokje’s picture

Status: Needs review » Needs work

- I think the test-failures are unrelated, random JavaScript failures.
- Left a comment in the MR.

Rashmisoni made their first commit to this issue’s fork.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

vbouchet’s picture

Status: Needs work » Needs review
StatusFileSize
new715 bytes

Please find a patch for 11.x branch.

The @todo was about removing a rule once an issue (https://www.drupal.org/node/1848264) was fixed so I removed the rule and the @todo.

smustgrave’s picture

Status: Needs review » Needs work

CC Failure.

vbouchet’s picture

Status: Needs work » Needs review
StatusFileSize
new13.14 KB

I did not realised that removing the exclude line would make phpcs to execute on more files. Please find an updated patch which fixes all the violations that was listed (I hope ;-)).

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Looks good

quietone’s picture

Status: Reviewed & tested by the community » Needs work

@vbouchet, That you for your interest in this issue. There was no need to make a patch because there is an existing MR with a fix. When an issue has an existing patch or MR it is best to continue working on that and not switch. More often than not it causes confusion.

The patch in #11 is perhaps for another issue? There is an MR and patch here, what has been RTBC'ed.

@smustgrave, I appreciate all the work you do to keep issues moving along! However, remember when marking an issue RTBC to explain what you did to review and research the change. Also, according to Examples of what will usually not receive credit credit is not given for Review or RTBC with only comments like "Looks good."

This needs a clear statement letting the committer know what has been RTBC'ed and why. Setting to needs work.

vbouchet’s picture

Thanks for the feedback @quietone. The MR was created on 10.x branch, needed rebase and there was a comment mentioning that the MR was not ready to be merged, this is why I went the shortest route for me.

I confirm the patch in #11 is for this issue and this is what has been reviewed and RTBC'ed.

What the patch does:
- Removes the @todo as per the issue description.
- The @todo were mentioning to remove the line after once an issue was fixed. This is the case so I removed the line which were excluding a directory from phpcs analysis.
- Fix the phpcs violation in the directory which was previously excluded.

Keeping as "Needs work" as I don't know what is the next step now.

quietone’s picture

Assigned: Unassigned » quietone
Status: Needs work » Postponed (maintainer needs more info)

@vbouchet, I was mistaken. I just didn't read this change correctly. Sorry about the confusion and thanks for the query.

But there is still a problem because this is changing third party code something we should not do. I think this should be postponed until Drupal 11 when the DiffEngine is removed from core. I will check with the other committers. I am setting PMNMI. And assigning to myself as a reminder.

Regarding rebasing there are instructions on Drupal.org for rebasing to a new branch or the same branch.

quietone’s picture

Title: Remove @todo from phpcs.xml.dist linking to closed issue » [11.x] Remove @todo from phpcs.xml.dist linking to closed issue
Assigned: quietone » Unassigned
Status: Postponed (maintainer needs more info) » Postponed
Issue tags: +Major version only

So, I have confirmed that we don't change the third party code (it would make updating it harder). The code is question though is being deprecated. So, let's remove the @todo in Drupal 11, after DiffEngine is removed.

I've noted this on #3295574: [meta] Remove deprecated classes, methods, procedural functions and code paths outside of deprecated modules on the Drupal 11 branch

quietone’s picture

Title: [11.x] Remove @todo from phpcs.xml.dist linking to closed issue » Remove @todo from phpcs.xml.dist linking to closed issue
Status: Postponed » Needs work

The issue in the @todo is now closed #1848264: Compare and merge PhpWiki diff*.php with MediaWiki's DairikiDiff.php and DiffEngine.php and the deprecated code has been removed, #3424436: [11.x] Remove deprecated code from the Diff component.

Setting this back to Needs Work.

ronttizz’s picture

Assigned: Unassigned » ronttizz

I will be working on this for today. Assigning to myself.

ronttizz’s picture

I am a bit confused here. There is couple of branches but I seem to have hard time setting these up and testing them.

ronttizz’s picture

Assigned: ronttizz » Unassigned
ronttizz’s picture

Status: Needs work » Needs review

I removed the suggested line.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new90 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. 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.

mradcliffe’s picture

I performed Novice Triage on this issue. I am leaving the Novice tag on this issue because I think we can update the issue summary to include the helpful comments by @quietone and update the issue fork to Drupal 11.

Novice issue reserved for the Mentored Contribution during DrupalCon Portland 2024 contribution day. After 2024.05.08, this issue returns to being open to all. Thanks
xjm’s picture

Please also be sure to hide the non-canonical merge requests. Thanks!

phaedrus’s picture

Issue summary: View changes

I'm looking at this issue during the first time contributor mentored session at Portland2024

phaedrus changed the visibility of the branch 3346401-remove-todo-from to hidden.

phaedrus changed the visibility of the branch 3346401-remove-todo-comment to hidden.

sime’s picture

The comment at #17 suggests that DiffEngine has been removed from core but there is still a lot of code at core/lib/Drupal/Component/Diff which appears to be remnants of DiffEngine. I see only deprecated code was removed in https://git.drupalcode.org/project/drupal/-/commit/b2477b3 which still left a lot of code.

So when @phaedrus (we are in contib sprint together) removed this exclude from the phpcs.xml.dist on d11, it has revealed a bunch of phpcs standards issues. I wonder will there be other issues that remove more DiffEngine code, so that this issue should remain blocked?

phaedrus’s picture

Issue summary: View changes
phaedrus’s picture

Issue summary: View changes
phaedrus’s picture

Issue summary: View changes

We ended up touching several places in order to come up to current coding standards. As of this time, tests are passing.

andypost’s picture

Status: Needs work » Needs review

It looks ready to go except renaming of public properties probably needs change record

smustgrave’s picture

Wont' changing the public properties require the BC dance? As this could be a breaking change right?

sime’s picture

Issue summary: View changes
sime’s picture

Issue summary: View changes
sime’s picture

So, ideally the three public properties of DiffFormatter.php should be deprecated first? We could tell phpcs to (inline) ignore these three lines for now and mark them deprecated.

sime’s picture

andypost’s picture

+1 to deprecate (not sure there's BC except magic get/set) for removal in 11.x

smustgrave’s picture

Status: Needs review » Needs work

Yea we will have to do the BC tango it seems. As @andypost mentioned _get/_set should be the route.

He shared this example via slack https://git.drupalcode.org/project/drupal/-/blob/10.3.x/core/lib/Drupal/...

sime’s picture

Oh wonderful. So will it be "deprecated in drupal:10.3.0 and is removed from drupal:11.0.0"?

smustgrave’s picture

Believe it depends if we can get ready before a release of 10.3 happens. Could be close but may be removed in 12 since an 11 tag for beta has already happened.

andypost’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Novice

Added branch with deprecation for 10.3 and filed CR https://www.drupal.org/node/3446709

Also fixed remaining CS, except phpcs:disable Drupal.Commenting.DocComment.ShortSingleLine as DiffFormatter.php is deprecated

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Deprecation looks great! Lets see if we can get this in for 10.3

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

This change is making public API changes - yes those variables are part of the public API as we can see in core's usage - for coding standard reasons. Given this is not really Drupal's code I'm not 100% convinced about the value of making this change - and it's too late for the 10.3.x ship. I think we should deprecate in 11.x and remove in 12.x if we want to make this change. I guess changing to typed properties is decent API ensuring bonues.

quietone’s picture

Issue summary: View changes
Issue tags: -Major version only

I have read the issue summary and comments. There is nice work here on keeping the issue summary update as well as figuring out how to do the deprecation. All of which is much appreciated!

What I can't find is a reason for changing the third party code. Looking into the history here, the original version of this issue summary questioned fixing the coding standards by using a simple statement, "Fix Coding Standards?". In #16 I stated that I confirmed that we don't change third party code, and this point is again confirmed alexpott in #46. Changing the code for coding standards was then questioned in #29 but then there is no discussion on that topic before it was added to the issue summary in #35. It is unfortunate that I didn't update the issue summary at the time on #16.

So, what to do here? We should remove the @todo but only that line. And keep the line that excludes the directory from coding standard checks.

And I did some research. The @todo was introduced in #2887052-22: Ignore Diff component files in phpcs coding standards. It seems there was a misunderstanding about what files were going to be to changed,

quietone’s picture

So, while I was writing this I was interrupted by a call that was demanding. When I came back I missed alexpott's comment about changing to typed properties. That's a good point to consider. I'll ask the other committers.

sime’s picture

I agree, when I dived in it seemed like the scope of previous issues had shifted.

We were surprised when the issue which was claimed to remove a whole library only removed part of it. We noticed there were only a few coding standards to fix so we went with that.

"We" is me and Phaedrus in contrib room.

damienmckenna’s picture

It's the end of July, 11.0.0-rc1 is out already, what's the plan here?

andypost’s picture

Looks it can go to 10.4.x but diff library still a question for me in terms of BC

andypost’s picture

Needs rebase and deprecation for 12.x

xjm’s picture

OK, this issue is long and meandering and seems to have changed scope, so forgive me if I misunderstand.

The D11 MR appears to be making changes to a component we explicitly do not change. It was more than just a PHPCS rule; it was that we actually wanted to keep the code in line with upstream. Are we giving up forever on that? If so, I'd like to see an explicit framework manager signoff, and a justification in the IS that's not just about followups and PHPCS cleanups.

Also, adding typehints to public properties is a BC break.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.