Problem/Motivation

The changes required for 'Drupal.Commenting.DocComment.ShortSingleLine' are too large and need to be split into child issues.

Proposed resolution

Fix class property comments for sniff 'Drupal.Commenting.DocComment.ShortSingleLine'.

Remaining tasks

Patch
Review - Instructions for adding the sniff and running the test are in the Issue Summary of #3123060: Enable 'Drupal.Commenting.DocComment.ShortSingleLine' coding standard
Commit

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3268833

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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quietone created an issue. See original summary.

quietone’s picture

Status: Active » Needs review
FileSize
77.84 KB
quietone’s picture

Title: Fix method comments in non tests for Drupal.Commenting.DocComment.ShortSingleLine » Fix method comments in tests for Drupal.Commenting.DocComment.ShortSingleLine
longwave’s picture

Status: Needs review » Reviewed & tested by the community

I read through the entire patch and all the comments make sense to me.

xjm credited Spokje.

xjm credited daffie.

xjm credited jungle.

xjm’s picture

Assigned: Unassigned » xjm
Status: Reviewed & tested by the community » Needs review

Adding additional credits from the original issue.

I'm going to convert this one to an MR; there are a number of things I think we should fix on scan and the MR's "suggestion" feature might make it easier for a docs patch like this.

xjm’s picture

Assigned: xjm » Unassigned
Status: Needs review » Needs work

Got about halfway through it, down to core/modules/media/tests/src/Functional/UrlResolverTest.php. Will come back to this more later. Someone could review and decide whether to accept the many proposed suggestions in the meanwhile. :)

xjm’s picture

Reviewed down to core/modules/system/tests/src/Functional/Form/ElementsLabelsTest.php so far; more suggestions. :)

xjm’s picture

Down to core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTest.php now.

xjm credited DanielVeza.

xjm’s picture

Adding issue credt for @DanielVeza who reported #3269018: Fix obsolete reference to entity_load_multiple. This MR is also fixing that already, so I closed it as a duplicate.

quietone’s picture

Issue tags: +Needs reroll

Let's get this up to date.

ravi.shankar made their first commit to this issue’s fork.

ravi.shankar’s picture

Issue tags: -Needs reroll

Resolved merge conflicts and updated the MR, removing the needs reroll tag.

quietone’s picture

Status: Needs work » Needs review

Back to need review.

smustgrave’s picture

Status: Needs review » Needs work

Tested this locally by commenting out the line in the phpcs file and running on the files from the diff.

FILE: /Users/smustgrave/Sites/Drupal-Demos/drupal-10.x/web/core/modules/dblog/tests/src/Functional/DbLogTest.php
------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------
 18 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph
FILE: /Users/smustgrave/Sites/Drupal-Demos/drupal-10.x/web/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php
-----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------------
 58 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph
-----------------------------------------------------------------------------------------------------------------------
FILE: /Users/smustgrave/Sites/Drupal-Demos/drupal-10.x/web/core/modules/field/tests/src/Kernel/FieldImportDeleteUninstallTest.php
---------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------
 11 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph
----------------------------------------------------------------------------------------------------------------------------
FILE: /Users/smustgrave/Sites/Drupal-Demos/drupal-10.x/web/core/modules/file/tests/src/Functional/FileManagedTestBase.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------
 12 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph
FILE: /Users/smustgrave/Sites/Drupal-Demos/drupal-10.x/web/core/modules/file/tests/src/Kernel/FileManagedUnitTestBase.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------
 13 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph
FILE: /Users/smustgrave/Sites/Drupal-Demos/drupal-10.x/web/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php
-------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------
 13 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph

FILE: /Users/smustgrave/Sites/Drupal-Demos/drupal-10.x/web/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php
--------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------
 503 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph
FILE: /Users/smustgrave/Sites/Drupal-Demos/drupal-10.x/web/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------------------------------------------------
 30 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph
 89 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph
 97 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph
FILE: /Users/smustgrave/Sites/Drupal-Demos/drupal-10.x/web/core/modules/system/tests/src/Functional/Form/StorageTest.php
------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------
 11 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph
quietone’s picture

Status: Needs work » Needs review

#19. All the instances reported are out of scope for this issue. I know, one can get lost on which subset of the problem these issues are focused on.

They are either a class comment or a class property comment. Class comments are being done in #3268809: Fix class comment doc blocks in tests for 'Drupal.Commenting.DocComment.ShortSingleLine'. Class property were done in #3268829: Fix class property comments for Drupal.Commenting.DocComment.ShortSingleLine and it looks like a few were missed. If there are only a few of these, then we may be able to done them in the last issue of this sniff. #3123060: Enable 'Drupal.Commenting.DocComment.ShortSingleLine' coding standard.

I am setting back to NR.

smustgrave’s picture

Thanks @quietone

there's one thread

This should also be an @covers. Maybe we could file a followup for this and the previous spot I mentioned it to keep the scope constrainted.

Does this need to be addressed?

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

So believe all the points have been addressed? Large MRs certainly are difficult.

needs-review-queue-bot’s picture

Status: Reviewed & tested by the community » Needs work
FileSize
90 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

quietone’s picture

Status: Needs work » Reviewed & tested by the community

Rebased and tests passing, restoring RTBC

longwave’s picture

Version: 10.0.x-dev » 10.1.x-dev
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

This needs reroll for 10.1.x.

Is there a way of enforcing this partial fix in phpcs.xml.dist?

jungle’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
88.2 KB

I did rebase on my local, instead of force pushing now, attaching a patch with git diff 10.1.x > ~/3268833-26.patch, in case i mess up the MR.

xjm’s picture

Status: Needs review » Needs work

Please don't switch these issues back to patches; they're really much harder to review as such. If you are worried about a force-push, you can try merging HEAD instead, or open a second MR temporarily.

xjm’s picture

The PHPStan error is:

 ------ --------------------------------------------------------------------- 
  Line   core/modules/system/tests/src/Kernel/System/FloodTest.php            
 ------ --------------------------------------------------------------------- 
  85     Instantiated class Drupal\Tests\system\Kernel\System\MemoryBackend   
         not found.                                                           
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols  
 ------ --------------------------------------------------------------------- 
xjm’s picture

Status: Needs work » Needs review

I was able to rebase this through the UI without any issues, so hiding the above patch.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
FileSize
90 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

jungle’s picture

Hi, @xjm yes, but you were rebasing against the 10.0.x branch, not 10.1,x which @longwave
asked

Repost here.

or open a second MR temporarily.

Sorry, I could not do it, because 10.1.x is not a valid reference on the current fork. Or please edit the target branch of the MR to 10.1.x.

Thanks!

xjm’s picture

Status: Needs work » Needs review

@jungle You do this by creating a new branch and new MR within the same repository. I did so just now by:

[ayrton:drupal | Fri 14:13:56] $ git checkout -b 3268833-10.1.x 10.1.x
Switched to a new branch '3268833-10.1.x'
[ayrton:drupal | Fri 14:14:04] $ curl https://www.drupal.org/files/issues/2023-02-24/3268833-27.patch | git apply --index -
[ayrton:drupal | Fri 14:14:52] $ git push --set-upstream drupal-3268833 HEAD

...Then clicking the "Open merge request" button for the new branch.

xjm’s picture

Just a note, I deliberately did not push any commits, because I noticed some bad hunks in the above patch. But the MR is functional, at least. :) Edit: Except I did just accidentally push it, which I am going to force-push away because of said bad hunks.

xjm’s picture

Updated with force push. Here's how I made this:

  1. git checkout -b 3268833-10.1.x 3268833-fix-method-comments
  2. Cherry-pick each commit from the 10.0.x MR. There was only one merge conflict:
    diff --cc core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
    index 8fa62025af,fa4ffdf6d1..0000000000
    --- a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
    +++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
    @@@ -466,20 -451,7 +465,24 @@@ class UrlGeneratorTest extends UnitTest
        }
      
        /**
    ++<<<<<<< HEAD
     +   * Tests deprecated methods.
     +   *
     +   * @group legacy
     +   */
     +  public function testDeprecatedMethods() {
     +    $this->expectDeprecation('Drupal\Core\Routing\UrlGenerator::getRouteDebugMessage() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use the route name instead. See https://www.drupal.org/node/3172303');
     +    $this->assertSame('test', $this->generator->getRouteDebugMessage('test'));
     +    $this->expectDeprecation('Drupal\Core\Routing\UrlGenerator::supports() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Only string route names are supported. See https://www.drupal.org/node/3172303');
     +    $this->assertTrue($this->generator->supports('test'));
     +  }
     +
     +  /**
     +   * Tests that the 'scheme' route requirement is respected during URL
     +   * generation.
    ++=======
    +    * Tests the 'scheme' route requirement is respected during url generation.
    ++>>>>>>> b8c71c1c9b ( #2)

    I resolved this by accepting the HEAD version for most of it, but capitalizing "URL" in our updated one-line docblock summary.

  3. git push --set-upstream drupal-3268833 HEAD --force
xjm’s picture

Note that there are several open threads on the previous merge request, so we should verify that those three threads are addressed before marking this RTBC again.

Edit: Note for committers, I also did not finish my previous committer review due to the diff size being outside the best practices for lines to review in one change set. I was into the taxonomy namespace. So methods after that may still have grammatical and similar errors that I was pushing back on earlier in the issue.

xjm’s picture

Hiding bot output files.

xjm’s picture

Status: Needs review » Needs work

I reviewed a little bit further, to core/modules/user/tests/src/Functional/UserCreateTest.php.

Note: A quick scan of the lines after those I reviewed revealed that no one has taken my previous suggestion of extrapolating and applying our other standards to later hunks. In general, one-line summaries should:

  • Make sense out of context.
  • Completely summarize what the method does.
  • Be grammatically correct (for example, no skipping small words like "the" or "that").
  • Start with a third-person indicative verb (e.g. "Tests").
  • Be a complete predicate for an English sentence.

Additionally, function, method, or class names should generally not be referenced in one-line summaries; rather, functions and methods should instead be added to the @see section of the docblock (with fully-qualified namespaces), or @covers where that applies.

quietone’s picture

Status: Needs work » Needs review

Time for another review.

smustgrave’s picture

let 1 comment on the thread. Not sure if it should move to NW for that.

If non issue +1 for RTBC

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Since it's been a week will go ahead and move this along to the committer.

quietone’s picture

Status: Reviewed & tested by the community » Needs review

Setting back to NR because changes where needed to @covers. See the last commit.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Fix for @covers seems fine to me.

  • longwave committed db5c7a1d on 10.1.x
    Issue #3268833 by quietone, xjm, jungle, ravi.shankar, smustgrave,...
longwave’s picture

Version: 10.1.x-dev » 10.0.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed and pushed to 10.1.x. Didn't apply cleanly to 10.0.x or 9.5.x, leaving open for possible backport to make other cherry picks easier.

quietone’s picture

Version: 10.0.x-dev » 9.5.x-dev
FileSize
16.33 KB
77.29 KB
17.45 KB
77.31 KB

@longwave, thanks!

Patches attached for 9.5.x and 10.0.x. For 9.5.x, there was one conflict, in \Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserRoleTest::assertRoles. For 10.0.x, the patch applied cleanly but I still made a new patch.

  • longwave committed 4d9d317a on 10.0.x
    Issue #3268833 by quietone, xjm, jungle, ravi.shankar, smustgrave,...

  • longwave committed 2a518a80 on 9.5.x
    Issue #3268833 by quietone, xjm, jungle, ravi.shankar, smustgrave,...
longwave’s picture

Status: Patch (to be ported) » Fixed

Committed and pushed to 10.0.x and 9.5.x, thanks!

  • longwave committed 5a97b17b on 10.0.x
    Issue #3268833 by quietone, xjm, jungle, ravi.shankar, smustgrave,...

  • longwave committed 43859947 on 9.5.x
    Issue #3268833 by quietone, xjm, jungle, ravi.shankar, smustgrave,...

  • longwave committed 510c9150 on 10.0.x
    Revert "Issue #3268833 by quietone, xjm, jungle, ravi.shankar,...

  • longwave committed 0d84250c on 9.5.x
    Revert "Issue #3268833 by quietone, xjm, jungle, ravi.shankar,...
longwave’s picture

The commits and reverts are because I committed #3123060: Enable 'Drupal.Commenting.DocComment.ShortSingleLine' coding standard with the wrong commit message.

Status: Fixed » Closed (fixed)

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