Problem/Motivation
@xjm:
Also, we have a silly rule that requires function and class one-line summaries to start with a verb.
-- see the comment here
And found the following after committed, see #3103090: Avoid re-scaffolding unchanged files (and printing scaffold file information over and over)
+++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ComposerHookTest.php
@@ -136,4 +127,29 @@ public function testComposerHooks() {
+ * Test to see if scaffold messages are omitted when running scaffold twice.
+ */
+ public function testScaffoldMessagesDoNotPrintTwice() {
Proposed resolution
There are many more to fix, but for this issue, just focus on replacing Test with Tests.
Remaining tasks
Needs followup for
- test class docblocks
- a sniff probably
@jungle Ah, keeping that narrow scope would work probably. The barrier for the generic rule is https://www.drupal.org/docs/develop/standards/api-documentation-and-comm...
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#76 | reroll_diff_67-74.txt | 173.61 KB | Neslee Canil Pinto |
#74 | 3133162-74.patch | 394.73 KB | Neslee Canil Pinto |
#67 | interdiff_63_67.txt | 5.3 KB | anmolgoyal74 |
#67 | 3133162-67.patch | 395.99 KB | anmolgoyal74 |
#63 | 3133162-63.patch | 395.95 KB | jungle |
Issue fork drupal-3133162
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
jungleThe commands used:
find core/ -type f -name "*.php" -print0 | xargs -0 gsed -i -E ':a;N;$!ba;s|(\*\*\n\s+\* Test) |\1s |g'
Comment #3
jungleComment #4
jungleTwo more things:
s
added. I think it's out of scope here to fix it. But maybe it's good to allow method comments of tests exceeding 80 chars. In general, it's just one line. Break them intosummary + blank line + description
is unnecessaryComment #5
jungleComment #6
jungleOoops, patches failed to apply as the victims of #3126906: MenuLinkContentTest.php is recognized as a binary file by git
Comment #7
jungleA new patch by using
git diff --text
Comment #8
jungleDo not cry, bot.
Comment #9
jungleComment #10
junglePatches for 8.8.x and 8.9.x
Comment #11
Kristen PolAssigning to myself for review.
Comment #12
Kristen PolThanks for the patch. Lots of changes!
IMO it's good to fix some formatting issues while doing this patch.
I explicitly looked for:
but didn't read each comment for clarity.
1) Changed Test => Tests:
Seemed ok.
2) Missing periods (not necessarily in order):
3) Text longer than 80 characters (not necessarily in order).
Note that some were already too long before the patch.
4) Text with "API's"
Should change API's to APIs.
Comment #13
jungle@Kristen Pol, thanKKK you so much!
I'd like this issue to have one scope, that replacing Test with Tests. -- 1) Changed Test => Tests:
For the following your pointed, I'd suggest doing in separate issue(s).
Comment #14
xjmI agree with the scope outlined in #13. The only exception would be if adding the silly
s
bumps a one-line summary that's exactly 80 chars to 81; then we would need to reword it to get it back under.Thanks!
Comment #15
Kristen PolOk, sounds good. Let me assign it back to me to identify just the ones that bump it one character for now.
Comment #16
Kristen PolHere are the ones that need adjusting due to being bumped by one character. Hopefully I found them all!
Possible rewording:
Tests placed content blocks create a dependency in the block placement.
Possible rewording:
Tests comments correctly invalidate the cache tag of their host entity.
Possible rewording:
Tests config override that provides cacheability metadata.
Same as above.
Possible rewording:
Since the previous test uses "Test validation with an invalid state." then this could be:
Tests validation with no initial state or an invalid state.
Possible rewording:
Tests chaining of the explode process with a handles_multiple process.
Possible rewording:
Tests title is not escaped (but XSS-filtered) for the details form element.
Possible rewording:
Tests language unspecific aliases are shown and saved in the node form.
Possible rewording:
Tests attribute creation for mappings that override human-readable content.
Possible rewording (remove extra space between "Tests" and "blocks").
Tests blocks with overridden related configuration removed when overridden.
Possible rewording:
Tests user password is re-hashed upon login after changing $count_log2.
Comment #17
jungleThanks @xjm for confirming the scope, and thanks you @Kristen Pol for your review and suggestions!
Found more with regex:
\s{3}\*\s{1}Tests.{70}\.
Explaination of the regex: 3 spaces + 1
*
char + 1 space + Tests (5 chars) + 70 any chars + 1 fullstop = 81 chars.Comment #18
jungleA patch for 8.8.x
Comment #19
jungleA patch for 8.9.x.
Comment #20
jungleAll patches failed to apply, because of annoying #3126906: MenuLinkContentTest.php is recognized as a binary file by git
Comment #21
Kristen PolAssigning to myself to review.
Comment #22
Kristen PolThanks for the updates and for finding more that needed fixing.
1) Reviewed the interdiff from #17.
IMO this isn't clear. How about:
Tests access to private files added to inline blocks in the layout builder.
IMO this isn't clear. How about:
Tests enabling a module that depends on incompatible version of a module.
2) Compared interdiff-8-17.txt, interdiff-8-18.txt, and interdiff-8-19.txt and they are equivalent.
3) Back to "Needs work" based on #1.
Comment #23
jungleThanks @Kristen Pol!
Addressing #22
Comment #24
Kristen PolThanks for the update.
1) The changes in #23 interdiff look good.
2) Should there be a 9.0 patch explicitly added?
3) Patches applied cleanly to drupal-8.8.x-dev, drupal-8.9.x-dev, drupal-9.0.x-dev (had offsets), and drupal-9.1.x-dev.
4) Waiting for tests to pass :)
5) Looks RTBC if tests pass. Thanks!
Comment #25
jungle@Kristen Pol, thank you, I think it's unnecessary to have a 9.0.x patch explicitly. I made the 9.x patch against 9.1.x, the committer can cheery-pick from 9.1.x to 9.0.x. But I am happy to reroll a 9.0.x patch if it's necessary.
Comment #26
Kristen PolSounds good. Tests have pass so marking RTBC. Thanks!
Comment #27
xjmOops, the 9.1.x patch fails to apply already with:
So it needs a reroll already... that might happen a lot as we work on this. I't suggest focusing on the 9.x patch until we get that in, then addressing 8.x once we've managed to get it committed.
Comment #28
xjmReviewed all the changes as far as
path.module
, just found this so far:I'm not sure this one works with
Tests
as written, because I think "test class" was a noun in the sentence before. How about:Can we double-check that that reflects what the test does? Ditto the D7 version.
Comment #29
jungleThanks @xjm.
A patch for 9.x.
Rejected file: core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldUpgradeTest.php.
Comment #30
xjmThis isn't a docblock for a method; it's a docblock for a member property that contains the data of the test file. So this one should be removed from the patch.
Comment #31
jungleNice catch! Thanks!
Comment #32
xjmAll these are member properties too and also should be reverted. (Sorry, still haven't gotten through the whole thing.)
Comment #33
jungleComment #34
jungleOoops, cross-posting. sorry
Comment #35
jungle/**
* Test administration path based conversion of entities.
* Tests administration path based conversion of entities.
*
* @group language
*/
class AdminPathEntityConverterLanguageTest
Self-reviewing! Changes to classes should be reverted too. in progress!
Comment #36
xjmMore properties here.
And this one.
And this one.
Also all fixtures.
Comment #37
xjmMore properties.
This one too.
And this.
Here also "Test class" was a noun; I suggest switching to:
Another one where it's "test controller" as a noun to describe a fixture... So change it to:
Another fixture...
(?) Look at what the thing actually does and describe it; I don't understand what's there.
Another fixture. This one should be:
...Dreditor pasted that accidentally so saving it so it's not lost; there's some more fixtures with the issue right after...
Comment #38
xjmThese are a little subtle but they're data providers -- they're not testing cases, they're providing test cases. So:
Lots more fixtures. All these can read "Provides a test... [rest of the words from the docblock]".
Another fixture.
All fixtures. "Provides a..."
Also fixtures. "Provides a..."
This should actually just be
{@inheritdoc}
Property, so the change can just be reverted.
Property; can be removed from the patch.
Properties.
Properties.
Fixtures.
Property to remove from the patch.
Comment #39
xjmNote that classes are also supposed to have a verb. But sometimes the verb is "Tests" when it's a test class. Other times the class might be a fixture and we can use "Provides a test..." or "Defines a test..."
Comment #40
jungle@xjm, thanks for the detailed review, too long to follow one by one, I already replaced from file names start with A to P now. is it ok sticking with the scope of methods only? Open new issues for others?
Comment #41
xjmI think the modified sentence here is confusing. How about:
This is the docblock for the whole test class. It's not testing a "case". I'd just say:
This is another fixture. Notice how the class is added at the end of another test class. I'd make this one:
These are weird but I don't think they're testing a method; I think they're providing test (helper) methods. So maybe:
"Provides test data..."
Provides test values...
It doesn't test coverage; it provides test coverage. But that will get too long. How about:
Properties, so exclude from patch.
Having déja vu, but in case this is just similar to something I already pasted rather than exactly the same, thwaw should be
Or something like thar.
Hmm, I don't think these are testing a description. I'd suggest leaving it alone here since this is an example. We could also make it "The test description" to make it clear "Test" isn't a verb anyway here.
Property, so exclude from patch.
OK, phew, done!
Edit: Crosspost. I'll get back to you on the scoping question in a bit; have to dash now.
Comment #42
jungleThe first iteration focused on reverting non-method changes with 2-3 times self-review on my local.
Comment #43
xjmI think doing just methods makes sense, with a followup for classes since they're more likely to be fixtures etc. With just methods, the one thing to watch out for will be the data providers.
Thanks! Let me know when you've had the chance to address all the feedback above (aside from points about properties and classes, etc.) and then I'll review again.
Comment #44
Kristen PolWow! Sorry I didn't catch the different applications of "Tests" noted in the comments above from @xjm. Based on the comments in #42 and #43 I'm unclear if it needs review yet.
Comment #45
jungleThanks @xjm for your confirmation and reminder.
Re #44, It's not ready for review yet. When it's ready, I will let you two know and update the status to NR. Thank you @Kristen Pol!
Comment #46
jungle2nd iteration, fixing failed tests in #42
Comment #47
jungleToo broad, so ignored, but I guess they were reverted already.
Ignored suggestion to stick with the scope.
Note: While checking
Tests cases for ::
, found more similar.déja vu by C21, one of my favorite bands, https://www.youtube.com/watch?v=0Hw6ZmevZdw
déja vu, déja vu, déja vu, haha
(Edited, reformatting)
Comment #48
xjmTagging for a followup for test class docblocks.
Comment #49
jofitz CreditAttribution: jofitz at jofitz commentedRemoved "Needs reroll" tag
Comment #50
jungleAdding needs follow up for a sniff (probably) to IS
Comment #51
jungleQuoting @xjm's comment on #50 in slack. and updated to IS
Comment #52
jungleComment #53
Kristen PolBack to "Needs work" for reroll.
Comment #54
ravi.shankar CreditAttribution: ravi.shankar at OpenSense Labs commentedComment #55
ravi.shankar CreditAttribution: ravi.shankar at OpenSense Labs commentedHere I have added reroll of #47.
Comment #56
jungleThanks @ravi.shankar for rerolling.
Rewrite to one line if possible
Rewrite to one line
Rewrite to one line
Rewrite to one-line
Rewrite to one line
Over 80 chars
Over 80 chars
Over 80 chars
Over 80 chars
Rewrite to one line
Rewrite to one line
Over 80 chars
Over 80 chars
Rewrite to one line
Over 80 chars
Over 80 chars
Comment #57
jungleComment #58
Deepak Goyal CreditAttribution: Deepak Goyal at Srijan | A Material+ Company for Drupal India Association commentedI am working on it
Comment #59
Deepak Goyal CreditAttribution: Deepak Goyal at Srijan | A Material+ Company for Drupal India Association commented@jungle Made changes as you suggested but some point that you suggested for Rewrite to one line is not possible. Please review.
Comment #60
ravi.shankar CreditAttribution: ravi.shankar at OpenSense Labs commentedAdded reroll of patch #59.
Comment #62
jungleMake this a beta target?
Comment #63
jungleRe-rolled
Comment #64
alex.mazaltov#63 Looks fine.
I will fetch it and will review it locally on Drupal 9.2.x. Hope no blockers will be in the local environment anyway I will get back to you in slack.
Comment #65
alex.mazaltovThat is protocol:
$make test
... perform all tests in drupal core after applying patch
Also, I have tested the same command
make test
with raw drupal core at branch 9.2.xIt gives the same result.
so I think we can make this issue as RTBC
Comment #66
longwaveReviewed with
git diff --color-words
.I think that this should still be "Tests that...", we can drop "correctly" I guess to keep it under the character limit.
Again I think we need to keep "Tests that" here, we can drop "set to" to shorten it, or reword to "Tests that Layout Builder is only enabled when overridable is TRUE."
This needs to be something like "Tests that a stub..."
We can't just drop "an" here.
We need to keep "that" here.
I don't think we should use & just so we can cut it down to 80 characters, let's just keep "and" and wrap this one.
Should be "...with a datetime object".
Again I find & hard to read, let's just use "and".
Comment #67
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commentedAddressed #66.
Comment #68
jungleComment #69
jungleComment #71
Kristen PolI have reviewed the interdiff in #67 and it addresses all of the items noted in #66.
Comment #72
Kristen PolForgot to switched to RTBC.
Comment #73
catchNeeds a re-roll.
Comment #74
Neslee Canil PintoRerolled to latest dev, when trying to create interdiff from #67 got following error
For info fixed in the following files which where not able to apply
Comment #75
quietone CreditAttribution: quietone as a volunteer commented@Neslee Canil Pinto, When the interdiff fails, make a diff, see Creating an interdiff-#What about rerolled patches?.
Comment #76
Neslee Canil Pinto@quietone this is the diff file that got generated when ran
diff -u 3133162-67.patch 3133162-74.patch > reroll_diff_67-74.txt
Comment #77
jungleThe reroll looks good, back to RTBC.
Comment #78
catchCommitted/pushed to 9.3.x and cherry-picked to 9.2.x, thanks!
Comment #79
Spokje@catch:
*cough*
Not showing up in Git branches of
9.2
nor9.3
?*cough*
Comment #81
catchComment #83
jungleComment #84
alexpottThe final 9.1.x release is out already - barring security releases so this one missed the boat... given it's for the 1 line documentation for test methods I think this is okay security issues don't often change that so I'd been surprised if this causes to make issues with creating security patches that apply to both 9.2.x and 9.1.x.
Comment #86
jungleComment #87
quietone CreditAttribution: quietone as a volunteer commentedI made the follow up asked for in #48, #3311746: Replace the start verb Test with Tests in test class docblocks