Problem/Motivation
The sniff "Drupal.Commenting.DocComment.ShortNotCapital" is not enabled.
Steps to reproduce
Proposed resolution
Enable the sniff "Drupal.Commenting.DocComment.ShortNotCapital" in core/phpcs.xml.dist and fix reported errors only for callbacks.
Callback have a special format so refer to the sections about documenting callbacks on API documentation and comment standards, particularly Render API callback functions
Remaining tasks
Review.
Enable the sniff except for core/tests/*
The followup to enable the sniff for all of core is #3511759: Enable 'Drupal.Commenting.DocComment.ShortNotCapital' coding standard.
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #86 | 2903027-nr-bot.txt | 42.33 KB | needs-review-queue-bot |
Issue fork drupal-2903027
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
mfernea commentedComment #3
mfernea commentedPartial work.
Comment #4
savkaviktor16@gmail.com commentedgoing to reroll it
Comment #5
savkaviktor16@gmail.com commentedre-rolled
Comment #6
jofitzComment #8
savkaviktor16@gmail.com commentedAdded some part of work an additional
@Jo, it may be useful don't put it to status "Needs review" until work done?
Comment #9
jofitzI set the status to "Needs review" to run the testbot on the patch you had re-rolled. Why did you not want it run? Similarly, why have you not set the status to "Needs review for your latest patch in #8?
Comment #10
savkaviktor16@gmail.com commentedI set the status to "Needs work" because the task isn`t finished (I did it similarly to the comment #3)
Anyway, I`m willing to get all the remarks/advises about work process. I`m new in contribution ) Thanks
Comment #11
andypostIt makes sense to run tests anyway - to get stats about how many inconsistencies left
Comment #13
savkaviktor16@gmail.com commentedComment #14
jofitzRe-rolled.
@Saviktor Are you working against the latest version of the 8.5.x branch? That might explain why your patch failed to apply.
Comment #16
jofitzPatch in #14 no longer applies. Re-rolled.
Comment #18
jofitzRe-rolled #14.
Comment #19
mfernea commentedThe patch contains a lot of modifications which are out of scope. Please remove them. At 17 I also pointed out another type of issue.
Out of scope.
Out of scope.
Out of scope.
Out of scope.
Out of scope.
Out of scope.
Out of scope.
Out of scope.
Out of scope.
Out of scope.
Out of scope.
Out of scope.
Out of scope.
Out of scope.
Out of scope.
Out of scope.
Let's try to not add new issues.
Out of scope.
Out of scope.
Out of scope.
Out of scope.
Out of scope.
Out of scope.
Out of scope.
Out of scope.
Comment #20
jofitzThanks for the review @mfernea.
Removed the out of scope changes and corrected a few more comments that didn't start with capital letters.
Most (if not all) of the remaining 'errors' are comments starting "(optional) ..." which I would argue should be allowed.
Any thoughts?
Comment #21
mfernea commentedLooks better!
Can we put this on one line?
I would just remove (optional) as it's not part of Coding standards and is not used consistently even in the classes where it is present.
Comment #22
jofitzRemoved all instances of (optional) at the beginning of comments and fixed the other coding standards error that had been introduced by the patch.
I could not think of a shorter comment that could remain on 1 line. I'm open to suggestions.
Comment #23
borisson_Do we need to fix this ; in this issue as well? It should be a period instead of the semicolon.
This removes the
*, making it invalid.Same here.
More of those.
Verifies that ::renderRoot() is not called in another ::renderRoot() call.Does that make sense?
Comment #24
Vidushi Mehta commentedI've made the above mention changes in a new patch.
Comment #25
Vidushi Mehta commentedComment #26
Vidushi Mehta commentedComment #27
Vidushi Mehta commenteduploading correct interdiff.
Comment #28
mfernea commented@borisson_'s #5 note from his last comment still needs to be addressed.
Other than that all issues mentioned by @borisson_ are solved and there aren't any new. Looks good to me!
Comment #29
jofitzAddressed @borisson_'s point 5 from #23.
Comment #30
mfernea commentedWe should add ShortNotCapital in the comment from above that statement. Please make sure it's in alpha order. Sorry for not pointing this earlier.
Other than that the patch looks fine and includes the other mentioned changes. Still applies cleanly and no cs issues.
Comment #31
jofitz@mfernea But the comment above (I assume you mean lines 32-34) is not currently in alphabetical order.
Comment #32
mfernea commentedIndeed! Just add it there then. :)
Comment #33
jofitzAdded ShortNotCapital to the list of errors to sniff for.
Comment #34
mfernea commentedGreat! RTBC then!
Comment #36
mfernea commentedThe failing test doesn't relate to modifications in this patch.
I guess it's related to this #2924201: Resolve random failure in LayoutBuilderTest so that it can be added to HEAD. Back to RTBC!
Comment #37
xjmThis docblock is already invalid; either
{@inheritdoc}should be the only thing in the docblock, or it needs to override the whole thing. We could spin this off into a separate issue.So, this issue is doing the opposite of #2909370: Fix 'Drupal.Commenting.VariableComment.IncorrectVarType' coding standard.
Looking at all the changes in this patch, many of which are to work around what is probably valid documentation, I'm thinking we need to fix this rule to be less strict, instead of fixing it. At least this particular pattern of a parenthetical before a sentence that starts with a capital and ends with a period should be allowed. So let's file an issue to tweak the rule, and postpone this issue on that.
Thanks!
Comment #38
xjmIt looks like we have a standard for the callbacks here that also doesn't match how we're fixing it in the patch: https://www.drupal.org/node/1354#callback-def
Comment #39
neclimdulFriendly post #2902381: Revert phpcs.xml.dist changes from "Ensure that we're using the right ruleset for coding standards checking" reroll. No feedback addressed. No credit needed.
Comment #40
mfernea commentedRegarding "(optional)" I added #2925237: ShortNotCapital triggered by non-letters.
Regarding "{@inheritdoc}" we already have #2904801: @inheritdoc without { } is treated as a tag and gives missleading message. The problem is widespread.
Comment #48
spokjeJust ran a test-run locally with this sniff, a lot seems to have changed for the better.
Unpostponing.
Comment #49
spokjeMoving in to MR-land.
Comment #51
spokjeComment #52
longwaveI am not 100% convinced this sniff adds anything useful, it doesn't help readability for me. It will also slow down patch authoring if test runs start to fail just because of this sniff, when they wouldn't otherwise.
Comment #53
spokjeNot sure about this one either, for me it also doesn't add much, however readability is about the same for me before and after this sniff.
One could argue that the "real bad" non-capitalized comments were fixed in other sniffs, and that they might sneak in again in new code without this sniff.
One could argue that the sniff should not check for comments starting with numbers or "non-letters" (uses Get-Out-Of-Jail-Free-Card-Because-I-Am-A-Non-Native-Speaker card there) like
!@#$%^&*().Personally I would just turn this sniff on to prevent future "nasty" comments.
Although true, I think this can be said about any sniff, so I'm not sure if it's a valid argument
Comment #54
quietone commentedI disagree with #51 so went ahead and reviewed the changes, no worries if they are not used. Personally, I do like the comment starting with 'The' and not '#'. And since this sniff picked up only 60 files, it is very unlikely to be disruptive. That is people are already writing new summary lines which will pass this sniff.
Comment #55
spokjeThus spoke the mighy @quietone in #54
That alone is (at least for me) a good reason to think it's not disruptive.
If it makes more readable code is up for debate, but is, of course, a matter of personal taste.
@quietone likes it, @longwave doesn't.
Personally I say: Turn this sniff on, since it's basically non-disruptive. It will only catch the (small amount of) people that incidentally write something that's not cAPITALIZED correctly.
For that reason I addressed all the issues found by @quietone and put this on NR again.
Comment #56
quietone commentedI read through the changes and it all looks good. For me, this is RTBC. Let's wait for longwave to chime in again.
Comment #57
longwaveSome of the changes here have swayed me to think that this is a good idea. Added a few comments/notes as I went along.
Comment #58
spokje2 unresolved threats remaining
Comment #59
longwaveAdded suggestions for the two outstanding.
Comment #60
spokjeThanks @longwave for the suggestions.
Changes made, all threads resolved -> NR
Comment #61
longwaveGreat, it's time to see what core committers think.
Comment #62
spokjeRandom test fail on last run, triggered new test run.
Comment #63
longwaveAnother instance of #3208791: [random test failure] Random fail in LayoutBuilderDisableInteractionsTest
Comment #64
catchQuestion/comment from me in the MR..
Comment #65
spokjeAn attempt to comment on the question/comment/suggestion/whatever from @catch in the MR, in the...
....
Wait for it....
.
..
...
MR :)
Comment #67
spokjeRebased MR against
9.3.x.Comment #68
paulocsI did a review and the patch fixes all doc comments that start with upper case character.
I'll move it RTBC and see if @catch will point any thing about #64.
I'm not attaching pictures from my local test because Drupal Automated Test would get it, but I ran
../vendor/bin/phpcs --extensions=php -p ./and no error is displayed.Comment #69
paulocsComment #70
spokjeThanks @paulocs for the Review.
I gave up on keeping MRs mergeable for non-RTBC issues, because somehow GitLab is notoriously bad at rebasing/merging with HEAD on Drupal (not noticed this on other projects), but since you made it an
RTBC, here's a merge with HEAD from9.3.xto get theMerge request !540showing up in Green again.Comment #71
spokjeRandom test-failure #3214565: [random test failure] Random fail in BuildTestTest::testPortMany
Comment #72
catchI think we should patch coder to be more permissive - coder should follow core coding standards rather than the other way around.
Comment #73
spokje@catch: Although I agree with what you're saying I also see a lot of effort put in this issue now slowly being eroded by new code and code changes.
Oh well, let's wait until coder gets patched.
Comment #74
quietone commentedThis is disappointing. This sniff is implementing what is in the coding standards. Does this mean the coding standards page is wrong and needs to be edited?
Comment #75
quietone commentedAdded to the IS that this is postponed on #3221049: Let ShortNotCapital allow starting with some characters that do not have case
Comment #80
quietone commentedComment #81
quietone commentedComment #82
quietone commentedRevisiting this. I am still not sure about the postponing of this issue. The standard states
For me, that means that the rule is, in fact, following the standard.
And further, I don't think that the changes made here are following the standard for callbacks either.
I am going to split this into two issues, one for the non-callbacks and one for the callbacks.
Comment #83
quietone commentedComment #84
quietone commentedComment #85
borisson_Looks like the last run on the merge request has some remaining failures, but I also have a question (posted on the MR).
Comment #86
needs-review-queue-bot commentedThe 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.
Comment #87
quietone commentedThe remaining failures are expected because this issue is only for callbacks. The sibling issue needs to be committed first #3508410: Fix 'Drupal.Commenting.DocComment.ShortNotCapital' coding standard except for callbacks.
But I wanted to see if these are correct in content and meet the special standard for callbacks.
Comment #88
borisson_Looks like the standard is indeed clear, but I didn't know that part of it, so for me this looks good.
Comment #89
borisson_Actually, I think I can rtbc this, as long as the committers know this can only be committed after the sibling issue.
Comment #90
nod_committed sibling issue, merge conflict to resolve now :)
Comment #91
quietone commentedRebased and fixed all violations for callbacks. Any other violations will be handled in a separate issue.
Since it is now possible to enable the sniff in most of core, this does change the phpcs.xml.dist
Comment #92
quietone commentedComment #93
borisson_Ok, back to rtbc it goes.
Comment #96
nod_Committed 52e18cc and pushed to 11.x. Thanks!
Comment #97
quietone commentedThere is a mistake in this commit, in ohpcs.xml.idst. Instead of adding this,
it should have been
Maybe this can be resolved in #3511759: Enable 'Drupal.Commenting.DocComment.ShortNotCapital' coding standard ?