Problem/Motivation
See #2909372-14: Enable 'Drupal.Commenting.VariableComment.MissingVar' coding standard for the reason why this child issue was created and #2909364: [meta] Fix 'Drupal.Commenting.VariableComment' coding standard for general instructions about working on Drupal.Commenting.VariableComment coding standard errors.
Steps to reproduce
Proposed resolution
Fix errors found by Drupal.Commenting.VariableComment.MissingVar for parameters that do not have a default value.
Remaining tasks
MR 3689 is for 11.x
Review
Commit
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #82 | 2924782-nr-bot.txt | 90 bytes | needs-review-queue-bot |
| #59 | 2924782-nr-bot.txt | 90 bytes | needs-review-queue-bot |
Issue fork drupal-2924782
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
Comment #2
zaporylieComment #3
ioana apetri commentedI will work on this.:)
Comment #4
zaporylie@yo30 - please check patch in #2909372-12: Enable 'Drupal.Commenting.VariableComment.MissingVar' coding standard. We have most of the work in place already, you can just extract part which is in the scope of this issue. Please note, that two co-child issues have landed already so you'll probably experience merge conflict, thus patch would have to be re-rolled.
In order to sniff for code errors violating Drupal.Commenting.VariableComment.MissingVar coding standard you must remove ignored rule from core/phpcs.xml.dist
Comment #5
ioana apetri commentedI checked the files for this error violation Drupal.Commenting.VariableComment.MissingVar and seems to be fine.
Comment #7
zaporylieComment #10
osmanComment #11
mfernea commentedI only see a missing change in core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php for:
Comment #12
osmanAre you by any chance referring to
core/modules/media/tests/src/Functional/MediaTranslationUITest.phpactually?Comment #13
mfernea commentedYes, indeed.
Comment #14
zaporylie#11 is already addressed in the base class the docblock is inherited from (ContentTranslationUITestBase) so, IMHO, doesn't need to be addressed here.
Comment #15
mfernea commentedThe best solution here is {@inheritdoc}, but that means we only need to add the "@". So, it's not part of this issue.
Comment #16
mfernea commentedAdding the correct status.
Comment #17
alexpottI disagree with @mfernea - if the inheritdoc is broken we should be fixing it here because then we don't need to add the @var at all.
Also we should be more specific if we can be i.e. use
@var string[]etc...I made a start of reviewing for this... but all the fixes here need checking...
@var string[]@var string[]@var object[]
string[]
string[]
string[]
string[]
string[]
string[]
Change to {@inheritdoc}
This change looks unnecessary the @var is on the parent.
Should be inheriting.
Use inheritdoc
inheritdoc
{@inheritdoc}
Comment #18
mfernea commentedIndeed, I was wrong. I thought it should be fixed in a sibling issue, but it's not. Let's fix it here.
Comment #22
spokjeComment #24
spokjeComment #26
spokjeRebased MR on
9.3.x.Comment #27
quietone commentedComment #28
spokjeComment #29
spokjeThanks @quietone for the review.
- Merged the latest
9.3.xinto the MR.- Found, added and fixed new offender.
- Resolved all but one thread.
Comment #30
spokjeComment #31
spokje9.4.x-devComment #32
quietone commentedI was still concerned that the scope of the patch is greater than the Issue Summary so did some research.
I have gone back to look at the parent and the siblings of this issue. I understand that this has been split into child issues on the recommendation xjm made 4 years ago. However, if the missing @var work is being split into several issues then the sniff can't be added by each sibling. And that is true, the siblings are not enabling the sniff. In this case, it is the parent that will enable the sniff and pick up what was not covered by the other siblings or crept into the code base.
So, I think the sniff needs to be removed and changes to @var that are not for 'arrays that provide default values' need to be removed. That will result in two smaller patches and thus easier to review.
However, we are already here and this is the last sibling, maybe it is more efficient to continue on here? I can't decide.
I'd like another opinion.
Comment #33
spokjeThanks @quietone.
Seeing this is indeed the last child, and the fact that the MR "only" (I use only lightly here, but most Coding Standards issues I've worked on included much more changes) contains ~50 changes, and the fact that splitting this issue up into 2 sub-issues would take a some time, I personally am a fan of:
- Not splitting this issue up: Mostly to save time, in my tiny mind, the review time will stay the same in either 1 or 2 issues. The main issue I see is that a bigger issue will take more time before it's reviewed and committed by a Core Committer/
- Enabling the sniff here: Don't do it here but do it in the parent issue opens the chances of new offenders creeping in. Seeing it's the last child issue, I can't see an advantage in enabling it in the parent, besides it being fully "according to the rules".
So, solely based on efficiency I'm a non-split advocate for this one. Willing to be convinced otherwise.
drops EUR 0.02
Comment #34
quietone commentedI too am not keen on someone spending time splitting this up, so let's move forward with this patch, unless a committer disagrees.
I'll work on reviewing the MR today.
Comment #35
quietone commentedUpdate IS
Comment #36
spokjeThanks @quietone.
Needing a second opinion about the two remaining
@var string[]or@var string[][]threads.Comment #37
quietone commentedSince I got confused about string[] and string[][] I asked in #bugsmash. Everyone agreed with the answer posted by kim.pepper (abbreviated)
Some responses also pointed out that the properties should be documented as well. I think that is the goal but we need to get there incrementally. This is just a step and prevents MissingVar from happening in the future.
I am going to review the MR now using the above definition.
Comment #38
quietone commentedThis time I went through the entire MR. I noted some things that are really out of scope. I should go back and resolve that but I need a break from this. Maybe tomorrow.
Setting to NW for the review of the MR.
Comment #42
quietone commentedImplementing sniffs are not bugs, they are tasks.
The failing test is not related to these changes, I am retesting.
Comment #44
quietone commentedChanging the scope to make the change set smaller and easier to review.
Comment #45
quietone commentedComment #46
smustgrave commentedReviewed the updates and changes appear correct.
Comment #47
longwaveMR has merge conflicts.
Comment #50
quietone commentedRebased
Comment #51
smustgrave commentedRebase seems good.
Comment #52
quietone commentedRebased and changed the instance in \Drupal\FunctionalTests\Update\UpdatePathTestBase to an {@inheritdoc}.
Comment #54
longwaveMR has a merge conflict and a question about the change to phpcs.xml.dist.
Also, the release note snippet in the IS seems wrong, as we are enabling that in the parent issue - not here.
Comment #55
quietone commentedRebased and had to fix mistakes so setting to NR.
Comment #56
smustgrave commentedRebase seems good.
Comment #57
alexpottI think we should be changing phpcs.xml to enable the rule no? Also I think removing the @var when there is a default value is really odd.
Comment #58
quietone commented@alexpott, thanks for the review.
Unfortunately, the scoping on this is unusual and the sniff can't be modified to cover this set of changes. However, I did enable the sniff for some file patterns. In the parent issue the remaining 50 errors in 32 files can be fixed and the sniff enable for all files.
Comment #59
needs-review-queue-bot commentedThe 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.
Comment #60
quietone commentedA straightforward rebase so restoring RTBC
Comment #61
alexpottThis change confuses me because it's removing @var from stuff... also if I only apply the changes to the phpcs.xml.dist and run PHPCS the other error that's found is:
So the rule changes are not covering the changes being made here.
Comment #66
quietone commentedThe 'Overview' in the MR does not reflect the actual changes and it quite confusing. There were also truly unexpected errors on my part that I can't quite figure out how they happened. So, I started over and it turns out that this can now enable the sniff as well.
So, I am closing the parent as a duplicate, changing the title and moving credit.
Comment #67
daffie commentedAll the documentation changes look good to me.
The remark of @alexpott has been addressed.
For me it is RTBC.
Comment #68
larowlanCouple of minor issues in the MR, also needs a reroll
Thanks for working on this.
Comment #70
kul.pratap commentedComment #71
quietone commented@kul.pratap, Welcome to Drupal! Thanks for working on this. I made a few comments in the MR. Also, This is failing the pre commit checks. It is good practice to Run core development checks locally before submitting a change.
There have been recent commits that are causing more errors. I don't think the sniff can be enabled here. This will have to go back to doing a subset of files. I'll look into that now.
Comment #72
kul.pratap commented@quietone Thank you for the feedback. I will review the comments in the MR and address them.
Comment #73
quietone commented@kul.pratap, thanks. I just added another change to exclude files in 'Plugin' directories. That should help here.
Updating title for the new scope.
I'll work on an issue for the changes in the 'Plugin' directories.
Comment #74
kul.pratap commented@quietone Should I resolve the unresolved issues in the MR as mentioned by you?
Comment #75
quietone commented@kul.pratap, Thanks for asking! The suggested changes to phpcs.xml.dist should exclude the files that have just started to cause violations from being checked by phpcs. Without those being checked that will bet this back on track to where only the feedback from larowlan and myself need to be resolved.
The files that have just started to cause the violations are going to be fixed in the parent issue, along with enabling the sniff on all of core. I've already set that up and postponed that on this issue.
I hope that all make sense.
Comment #76
kul.pratap commented@quietone Please review.
Comment #77
smustgrave commentedPipeline has errors. Would recommend verifying that everything passes before putting into review please.
Comment #78
quietone commented@kul.pratap, thanks for reverting those changes.
I was concerned that the number of files to change would make the MR here larger that our recommended size. So, I've updated phpcs.xml.dist to ignore Plugin files, which agrees with the title here. There are still about 25 files to edit.
Comment #79
quietone commentedMore changes for recent commits.
Comment #80
smustgrave commentedTried to resolve some threads but things got messy at some point. Left most open.
Comment #81
quietone commentedThis is at least the second time I have had the gitlab MR UI disagree with the changes that are actually in the branch. It is very confusing.
We need to agree to the change for core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTestBase.php.
Comment #82
needs-review-queue-bot commentedThe 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.
Comment #83
quietone commentedI meant to re-scope this but I accidentally created a new issue to divide up the work for this sniff.
I am closing as a duplicate an transferring credit to #2909372: Enable 'Drupal.Commenting.VariableComment.MissingVar' coding standard