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

Issue fork drupal-2903027

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

mfernea created an issue. See original summary.

mfernea’s picture

Assigned: Unassigned » mfernea
mfernea’s picture

Assigned: mfernea » Unassigned
Status: Active » Needs work
StatusFileSize
new37.29 KB

Partial work.

savkaviktor16@gmail.com’s picture

Issue tags: +Needs reroll

going to reroll it

savkaviktor16@gmail.com’s picture

Issue tags: -Needs reroll
StatusFileSize
new37 KB

re-rolled

jofitz’s picture

Status: Needs work » Needs review

The last submitted patch, 3: drupal-coding-standards-2903027-2.patch, failed testing. View results

savkaviktor16@gmail.com’s picture

Status: Needs review » Needs work
StatusFileSize
new58.54 KB
new21.54 KB

Added some part of work an additional
@Jo, it may be useful don't put it to status "Needs review" until work done?

jofitz’s picture

I 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?

savkaviktor16@gmail.com’s picture

I 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

andypost’s picture

Status: Needs work » Needs review

It makes sense to run tests anyway - to get stats about how many inconsistencies left

Status: Needs review » Needs work

The last submitted patch, 8: drupal-coding-standards-2903027-8.patch, failed testing. View results

savkaviktor16@gmail.com’s picture

Issue tags: +Needs reroll
jofitz’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new58.58 KB

Re-rolled.

@Saviktor Are you working against the latest version of the 8.5.x branch? That might explain why your patch failed to apply.

Status: Needs review » Needs work

The last submitted patch, 14: 2903027-14.patch, failed testing. View results

jofitz’s picture

Status: Needs work » Needs review
StatusFileSize
new0 bytes

Patch in #14 no longer applies. Re-rolled.

Status: Needs review » Needs work

The last submitted patch, 16: 2903027-16.patch, failed testing. View results

jofitz’s picture

Status: Needs work » Needs review
StatusFileSize
new58.63 KB

Re-rolled #14.

mfernea’s picture

Status: Needs review » Needs work

The patch contains a lot of modifications which are out of scope. Please remove them. At 17 I also pointed out another type of issue.

  1. +++ b/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php
    @@ -151,9 +151,9 @@ public function testTimestamp($input, array $initial, array $transform) {
        * @param string $input
        *   Input argument for DateTimePlus().
        * @param array $initial
    -   *   @see testTimestamp()
        * @param array $transform
    -   *   @see testTimestamp()
    +   *
    +   * @see testTimestamp()
    

    Out of scope.

  2. +++ b/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php
    @@ -164,17 +164,16 @@ public function testDateTimestamp($input, array $initial, array $transform) {
    -   * Assertion helper for testTimestamp and testDateTimestamp since they need
    -   * different dataProviders.
    +   * Assertion helper for testTimestamp and testDateTimestamp since they need different dataProviders.
        *
        * @param DateTimePlus $date
        *   DateTimePlus to test.
    -   * @input mixed $input
    +   * @param mixed $input
        *   The original input passed to the test method.
        * @param array $initial
    -   *   @see testTimestamp()
        * @param array $transform
    -   *   @see testTimestamp()
    +   *
    +   * @see testTimestamp()
        */
    

    Out of scope.

  3. +++ b/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php
    @@ -247,8 +246,7 @@ public function testInvalidDates($input, $timezone, $format, $message, $class) {
    -   * Tests that DrupalDateTime can detect the right timezone to use.
    -   * When specified or not.
    +   * Tests that DrupalDateTime can detect the right timezone to use. When specified or not.
    

    Out of scope.

  4. +++ b/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php
    @@ -268,8 +266,7 @@ public function testDateTimezone($input, $timezone, $expected_timezone, $message
    -   * Test that DrupalDateTime can detect the right timezone to use when
    -   * constructed from a datetime object.
    +   * Test that DrupalDateTime can detect the right timezone to use when constructed from a datetime object.
    

    Out of scope.

  5. +++ b/core/tests/Drupal/Tests/Component/Utility/EnvironmentTest.php
    @@ -17,9 +17,6 @@ class EnvironmentTest extends TestCase {
    -   * @dataProvider providerTestCheckMemoryLimit
    -   * @covers ::checkMemoryLimit
    -   *
        * @param string $required
        *   The required memory argument for
        *   \Drupal\Component\Utility\Environment::checkMemoryLimit().
    @@ -29,6 +26,9 @@ class EnvironmentTest extends TestCase {
    
    @@ -29,6 +26,9 @@ class EnvironmentTest extends TestCase {
        * @param bool $expected
        *   The expected return value from
        *   \Drupal\Component\Utility\Environment::checkMemoryLimit().
    +   *
    +   * @dataProvider providerTestCheckMemoryLimit
    +   * @covers ::checkMemoryLimit
        */
    

    Out of scope.

  6. +++ b/core/tests/Drupal/Tests/Component/Utility/VariableTest.php
    @@ -64,17 +64,17 @@ public function providerTestExport() {
    -        // 2 backslashes. \\
    +        // 2 backslashes \\.
             "'\\'",
             '\\',
           ],
           [
    -        // Double-quote "
    +        // Double-quote ".
             "'\"'",
             "\"",
           ],
           [
    -        // Single-quote '
    +        // Single-quote '.
    

    Out of scope.

  7. +++ b/core/tests/Drupal/Tests/Component/Utility/VariableTest.php
    @@ -100,13 +100,13 @@ public function providerTestExport() {
    -   * @dataProvider providerTestExport
    -   * @covers ::export
    -   *
        * @param string $expected
        *   The expected exported variable.
        * @param mixed $variable
        *   The variable to be exported.
    +   *
    +   * @dataProvider providerTestExport
    +   * @covers ::export
        */
    

    Out of scope.

  8. +++ b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php
    @@ -884,16 +884,15 @@ public function testOrIfCacheabilityMerging() {
    -   * @covers ::allowedIfHasPermissions
    -   *
    -   * @dataProvider providerTestAllowedIfHasPermissions
    -   *
        * @param string[] $permissions
        *   The permissions to check for.
        * @param string $conjunction
        *   The conjunction to use when checking for permission. 'AND' or 'OR'.
        * @param \Drupal\Core\Access\AccessResult $expected_access
        *   The expected access check result.
    +   *
    +   * @dataProvider providerTestAllowedIfHasPermissions
    +   * @covers ::allowedIfHasPermissions
    

    Out of scope.

  9. +++ b/core/tests/Drupal/Tests/Core/Common/AttributesTest.php
    @@ -57,7 +57,7 @@ public function testDrupalAttributes($attributes, $expected, $message) {
    -   * Test attribute iteration
    +   * Test attribute iteration.
    

    Out of scope.

  10. +++ b/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php
    @@ -14,6 +14,8 @@
    +   * The cache factory.
    +   *
        * @var \Drupal\Core\Cache\CacheFactoryInterface|\PHPUnit_Framework_MockObject_MockObject
    

    Out of scope.

  11. +++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php
    @@ -30,8 +30,7 @@ protected function setUpConfigEntityType($definition) {
    -   * Tests that we get an exception when the length of the config prefix that is
    -   * returned by getConfigPrefix() exceeds the maximum defined prefix length.
    +   * Tests that we get an exception when the length of the config prefix that is returned by getConfigPrefix() exceeds the maximum defined prefix length.
    
    @@ -51,8 +50,7 @@ public function testConfigPrefixLengthExceeds() {
    -   * Tests that a valid config prefix returned by getConfigPrefix()
    -   * does not throw an exception and is formatted as expected.
    +   * Tests that a valid config prefix returned by getConfigPrefix() does not throw an exception and is formatted as expected.
    

    Out of scope.

  12. +++ b/core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php
    @@ -197,7 +197,7 @@ public function testFindSitePath() {
    -   * A fake autoloader for testing
    +   * A fake autoloader for testing.
    
    +++ b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php
    @@ -152,7 +152,7 @@ public function testGetModuleList() {
    -   * Confirm we get back a module from the module list
    +   * Confirm we get back a module from the module list.
    

    Out of scope.

  13. +++ b/core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php
    @@ -83,14 +83,13 @@ public function testIsDefault() {
    -   * @covers ::sort
    -   *
    -   * @dataProvider providerTestSortArrayOfLanguages
    -   *
        * @param \Drupal\Core\Language\LanguageInterface[] $languages
        *   An array of language objects.
        * @param array $expected
        *   The expected array of keys.
    +   *
    +   * @dataProvider providerTestSortArrayOfLanguages
    +   * @covers ::sort
    

    Out of scope.

  14. +++ b/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php
    @@ -95,7 +95,7 @@ public function testConvert($value, array $definition, array $defaults, $expecte
    -   * Provides test data for testConvert
    +   * Provides test data for testConvert.
    

    Out of scope.

  15. +++ b/core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php
    @@ -26,6 +26,7 @@ class PathValidatorTest extends UnitTestCase {
    +   *
    

    Out of scope.

  16. +++ b/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php
    @@ -396,7 +396,7 @@ public function testMergeAttachmentsFeedMerging($a, $b, $expected) {
    -   * Data provider for testMergeAttachmentsFeedMerging
    +   * Data provider for testMergeAttachmentsFeedMerging.
    
    @@ -455,7 +455,7 @@ public function testMergeAttachmentsHtmlHeadMerging($a, $b, $expected) {
    -   * Data provider for testMergeAttachmentsHtmlHeadMerging
    +   * Data provider for testMergeAttachmentsHtmlHeadMerging.
    
    @@ -528,7 +528,7 @@ public function testMergeAttachmentsHtmlHeadLinkMerging($a, $b, $expected) {
    -   * Data provider for testMergeAttachmentsHtmlHeadLinkMerging
    +   * Data provider for testMergeAttachmentsHtmlHeadLinkMerging.
    
    @@ -594,7 +594,7 @@ public function testMergeAttachmentsHttpHeaderMerging($a, $b, $expected) {
    -   * Data provider for testMergeAttachmentsHttpHeaderMerging
    +   * Data provider for testMergeAttachmentsHttpHeaderMerging.
    

    Out of scope.

  17. +++ b/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php
    @@ -26,7 +26,7 @@ protected function setUpRenderRecursionComplexElements() {
    -   * ::renderRoot() may not be called inside of another ::renderRoot() call.
    +   * The method ::renderRoot() may not be called inside of another ::renderRoot() call.
    

    Let's try to not add new issues.

  18. +++ b/core/tests/Drupal/Tests/Core/Routing/RouteMatchTestBase.php
    @@ -22,6 +22,7 @@
    +   *
        * @return \Drupal\Core\Routing\RouteMatchInterface
    

    Out of scope.

  19. +++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
    @@ -175,8 +175,7 @@ protected function setUp() {
    -   * Return value callback for the getAliasByPath() method on the mock alias
    -   * manager.
    +   * Return value callback for the getAliasByPath() method on the mock alias manager.
    

    Out of scope.

  20. +++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
    @@ -429,7 +428,7 @@ public function testAbsoluteURLGenerationUsingInterfaceConstants() {
    -   * Confirms that explicitly setting the base_url works with generated routes
    +   * Confirms that explicitly setting the base_url works with generated routes.
    

    Out of scope.

  21. +++ b/core/tests/Drupal/Tests/Core/Site/SettingsTest.php
    @@ -66,7 +66,7 @@ public function testGetInstance() {
    -   * Tests Settings::getHashSalt();
    +   * Tests Settings::getHashSalt().
        *
    

    Out of scope.

  22. +++ b/core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php
    @@ -20,6 +20,8 @@
    +   * The app kernel.
    +   *
    
    +++ b/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php
    @@ -33,6 +33,7 @@ protected function setUp() {
    +   *
    
    +++ b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php
    @@ -74,6 +74,7 @@ public function testRemove() {
    +   *
    
    @@ -102,6 +103,7 @@ public function testSetAttribute() {
    +   *
    
    @@ -141,6 +143,7 @@ public function testRemoveAttribute() {
    +   *
    
    @@ -193,6 +196,7 @@ public function testAddClasses() {
    +   *
    
    @@ -224,6 +228,7 @@ public function testRemoveClasses() {
    +   *
    
    @@ -239,6 +244,7 @@ public function testHasClass() {
    +   *
    
    @@ -257,6 +263,7 @@ public function testChainAddRemoveClasses() {
    +   *
    

    Out of scope.

  23. +++ b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php
    @@ -273,7 +280,7 @@ public function testTwigAddRemoveClasses($template, $expected, $seed_attributes
    -   * Provides tests data for testEscaping
    +   * Provides tests data for testEscaping.
    
    +++ b/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php
    @@ -71,7 +71,7 @@ public function setUp() {
    -   * Tests the escaping
    +   * Tests the escaping.
    
    @@ -94,7 +94,7 @@ public function testEscaping($template, $expected) {
    -   * Provides tests data for testEscaping
    +   * Provides tests data for testEscaping.
    

    Out of scope.

  24. +++ b/core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php
    @@ -17,23 +17,23 @@
    -   * @var \Drupal\Core\Theme\AjaxBasePageNegotiator
    -   *
        * The AJAX base page negotiator.
    +   *
    +   * @var \Drupal\Core\Theme\AjaxBasePageNegotiator
    ...
    -   * @var \Drupal\Core\Access\CsrfTokenGenerator|\Prophecy\Prophecy\ProphecyInterface
    -   *
        * The CSRF token generator.
    +   *
    +   * @var \Drupal\Core\Access\CsrfTokenGenerator|\Prophecy\Prophecy\ProphecyInterface
    ...
    -   * @var \Symfony\Component\HttpFoundation\RequestStack
    -   *
        * The request stack.
    +   *
    +   * @var \Symfony\Component\HttpFoundation\RequestStack
    

    Out of scope.

  25. +++ b/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php
    @@ -251,6 +251,7 @@ public function testValidatePropertyWithInvalidObjects($object) {
    +   *
    
    +++ b/core/tests/Drupal/Tests/Core/UnroutedUrlTest.php
    @@ -15,7 +15,7 @@
    -   * The URL assembler
    +   * The URL assembler.
    
    +++ b/core/tests/Drupal/Tests/EntityViewTrait.php
    @@ -30,6 +30,7 @@
    +   *
    

    Out of scope.

jofitz’s picture

Status: Needs work » Needs review
StatusFileSize
new26.08 KB
new44.46 KB

Thanks 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?

mfernea’s picture

Status: Needs review » Needs work

Looks better!

+++ b/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php
@@ -26,7 +26,8 @@ protected function setUpRenderRecursionComplexElements() {
-   * ::renderRoot() may not be called inside of another ::renderRoot() call.
+   * The method ::renderRoot() may not be called inside of another
+   * ::renderRoot() call.

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.

jofitz’s picture

Status: Needs work » Needs review
StatusFileSize
new7.73 KB
new51.59 KB

Removed 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.

borisson_’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/content_translation/content_translation.admin.inc
    @@ -165,7 +165,7 @@ function _content_translation_is_field_translatability_configurable(EntityTypeIn
    - * (proxied) Implements hook_preprocess_HOOK();
    + * Implements hook_preprocess_HOOK() (proxied);
    

    Do we need to fix this ; in this issue as well? It should be a period instead of the semicolon.

  2. +++ b/core/modules/views/src/Annotation/ViewsAccess.php
    @@ -30,7 +30,7 @@ class ViewsAccess extends ViewsPluginAnnotationBase {
    -   * (optional) The short title used in the views UI.
    +   The short title used in the views UI.
    

    This removes the *, making it invalid.

  3. +++ b/core/modules/views/src/Annotation/ViewsArgumentDefault.php
    @@ -30,7 +30,7 @@ class ViewsArgumentDefault extends ViewsPluginAnnotationBase {
    -   * (optional) The short title used in the views UI.
    +   The short title used in the views UI.
    

    Same here.

  4. +++ b/core/modules/views/src/Annotation/ViewsArgumentValidator.php
    @@ -30,7 +30,7 @@ class ViewsArgumentValidator extends ViewsPluginAnnotationBase {
    -   * (optional) The short title used in the views UI.
    +   The short title used in the views UI.
    
    +++ b/core/modules/views/src/Annotation/ViewsCache.php
    @@ -30,7 +30,7 @@ class ViewsCache extends ViewsPluginAnnotationBase {
    -   * (optional) The short title used in the views UI.
    +   The short title used in the views UI.
    
    +++ b/core/modules/views/src/Annotation/ViewsDisplay.php
    @@ -30,7 +30,7 @@ class ViewsDisplay extends ViewsPluginAnnotationBase {
    -   * (optional) The short title used in the views UI.
    +   The short title used in the views UI.
    
    +++ b/core/modules/views/src/Annotation/ViewsDisplayExtender.php
    @@ -30,7 +30,7 @@ class ViewsDisplayExtender extends ViewsPluginAnnotationBase {
    -   * (optional) The short title used in the views UI.
    +   The short title used in the views UI.
    
    +++ b/core/modules/views/src/Annotation/ViewsExposedForm.php
    @@ -31,7 +31,7 @@ class ViewsExposedForm extends ViewsPluginAnnotationBase {
    -   * (optional) The short title used in the views UI.
    +   The short title used in the views UI.
    
    +++ b/core/modules/views/src/Annotation/ViewsPager.php
    @@ -30,7 +30,7 @@ class ViewsPager extends ViewsPluginAnnotationBase {
    -   * (optional) The short title used in the views UI.
    +   The short title used in the views UI.
    
    +++ b/core/modules/views/src/Annotation/ViewsQuery.php
    @@ -30,7 +30,7 @@ class ViewsQuery extends ViewsPluginAnnotationBase {
    -   * (optional) The short title used in the views UI.
    +   The short title used in the views UI.
    
    +++ b/core/modules/views/src/Annotation/ViewsRow.php
    @@ -30,7 +30,7 @@ class ViewsRow extends ViewsPluginAnnotationBase {
    -   * (optional) The short title used in the views UI.
    +   The short title used in the views UI.
    
    +++ b/core/modules/views/src/Annotation/ViewsStyle.php
    @@ -30,7 +30,7 @@ class ViewsStyle extends ViewsPluginAnnotationBase {
    -   * (optional) The short title used in the views UI.
    +   The short title used in the views UI.
    
    +++ b/core/modules/views/src/Annotation/ViewsWizard.php
    @@ -31,7 +31,7 @@ class ViewsWizard extends ViewsPluginAnnotationBase {
    -   * (optional) The short title used in the views UI.
    +   The short title used in the views UI.
    

    More of those.

  5. +++ b/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php
    @@ -26,7 +26,8 @@ protected function setUpRenderRecursionComplexElements() {
    -   * ::renderRoot() may not be called inside of another ::renderRoot() call.
    +   * The method ::renderRoot() may not be called inside of another
    +   * ::renderRoot() call.
    

    Verifies that ::renderRoot() is not called in another ::renderRoot() call.

    Does that make sense?

Vidushi Mehta’s picture

StatusFileSize
new51.6 KB
new6.28 KB

I've made the above mention changes in a new patch.

Vidushi Mehta’s picture

Vidushi Mehta’s picture

Status: Needs work » Needs review
Vidushi Mehta’s picture

StatusFileSize
new6.11 KB

uploading correct interdiff.

mfernea’s picture

Status: Needs review » Needs work

@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!

jofitz’s picture

Status: Needs work » Needs review
StatusFileSize
new51.6 KB
new622 bytes

Addressed @borisson_'s point 5 from #23.

mfernea’s picture

Status: Needs review » Needs work
+++ b/core/phpcs.xml.dist
@@ -38,7 +38,6 @@
-    <exclude name="Drupal.Commenting.DocComment.ShortNotCapital"/>
     <exclude name="Drupal.Commenting.DocComment.ShortFullStop"/>

We 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.

jofitz’s picture

@mfernea But the comment above (I assume you mean lines 32-34) is not currently in alphabetical order.

mfernea’s picture

Indeed! Just add it there then. :)

jofitz’s picture

Status: Needs work » Needs review
StatusFileSize
new52.09 KB
new664 bytes

Added ShortNotCapital to the list of errors to sniff for.

mfernea’s picture

Status: Needs review » Reviewed & tested by the community

Great! RTBC then!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 33: 2903027-33.patch, failed testing. View results

mfernea’s picture

Status: Needs work » Reviewed & tested by the community

The 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!

xjm’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php
    @@ -94,6 +94,7 @@ public static function multipleValidate($element, FormStateInterface $form_state
       /**
        * {@inheritdoc}
    +   *
        * Used in \Drupal\field\Tests\EntityReference\EntityReferenceAdminTest::testAvailableFormatters().
        */
    

    This 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.

  2. +++ b/core/modules/media/src/Annotation/MediaSource.php
    @@ -80,7 +80,7 @@ class MediaSource extends Plugin {
    -   * (optional) The metadata attribute name to provide the thumbnail alt.
    +   * The metadata attribute name to provide the thumbnail alt.
    
    @@ -89,7 +89,7 @@ class MediaSource extends Plugin {
    -   * (optional) The metadata attribute name to provide the thumbnail title.
    +   * The metadata attribute name to provide the thumbnail title.
    
    +++ b/core/modules/views/src/Annotation/ViewsArgumentDefault.php
    @@ -30,7 +30,7 @@ class ViewsArgumentDefault extends ViewsPluginAnnotationBase {
    -   * (optional) The short title used in the views UI.
    +   * The short title used in the views UI.
    
    +++ b/core/modules/views/src/Annotation/ViewsArgumentValidator.php
    @@ -30,7 +30,7 @@ class ViewsArgumentValidator extends ViewsPluginAnnotationBase {
    -   * (optional) The short title used in the views UI.
    +   * The short title used in the views UI.
    
    +++ b/core/modules/views/src/Annotation/ViewsCache.php
    @@ -30,7 +30,7 @@ class ViewsCache extends ViewsPluginAnnotationBase {
    -   * (optional) The short title used in the views UI.
    +   * The short title used in the views UI.
    
    +++ b/core/modules/views/src/Annotation/ViewsDisplay.php
    @@ -30,7 +30,7 @@ class ViewsDisplay extends ViewsPluginAnnotationBase {
    -   * (optional) The short title used in the views UI.
    +   * The short title used in the views UI.
    
    +++ b/core/modules/views/src/Annotation/ViewsDisplayExtender.php
    @@ -30,7 +30,7 @@ class ViewsDisplayExtender extends ViewsPluginAnnotationBase {
    -   * (optional) The short title used in the views UI.
    +   * The short title used in the views UI.
    
    +++ b/core/modules/views/src/Annotation/ViewsExposedForm.php
    @@ -31,7 +31,7 @@ class ViewsExposedForm extends ViewsPluginAnnotationBase {
    -   * (optional) The short title used in the views UI.
    +   * The short title used in the views UI.
    

    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!

xjm’s picture

It 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

neclimdul’s picture

StatusFileSize
new52.47 KB
mfernea’s picture

Status: Needs work » Postponed
Related issues: +#2925237: ShortNotCapital triggered by non-letters

Regarding "(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.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

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

spokje’s picture

Assigned: Unassigned » spokje
Status: Postponed » Needs work

Just ran a test-run locally with this sniff, a lot seems to have changed for the better.
Unpostponing.

spokje’s picture

Issue tags: -Novice

Moving in to MR-land.

spokje’s picture

Assigned: spokje » Unassigned
Status: Needs work » Needs review
longwave’s picture

I 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.

spokje’s picture

I am not 100% convinced this sniff adds anything useful, it doesn't help readability for me.

Not 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.

It will also slow down patch authoring if test runs start to fail just because of this sniff, when they wouldn't otherwise.

Although true, I think this can be said about any sniff, so I'm not sure if it's a valid argument

quietone’s picture

I 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.

spokje’s picture

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.

Thus 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.

quietone’s picture

I read through the changes and it all looks good. For me, this is RTBC. Let's wait for longwave to chime in again.

longwave’s picture

Some of the changes here have swayed me to think that this is a good idea. Added a few comments/notes as I went along.

spokje’s picture

Status: Needs review » Needs work

2 unresolved threats remaining

longwave’s picture

Added suggestions for the two outstanding.

spokje’s picture

Status: Needs work » Needs review

Thanks @longwave for the suggestions.

Changes made, all threads resolved -> NR

longwave’s picture

Status: Needs review » Reviewed & tested by the community

Great, it's time to see what core committers think.

spokje’s picture

Random test fail on last run, triggered new test run.

Failed asserting that 'unknown error: session deleted because of page crash\n
from unknown error: cannot determine loading status\n
from tab crashed\n
longwave’s picture

catch’s picture

Status: Reviewed & tested by the community » Needs review

Question/comment from me in the MR..

spokje’s picture

An attempt to comment on the question/comment/suggestion/whatever from @catch in the MR, in the...
....
Wait for it....
.
..
...
MR :)

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

spokje’s picture

Rebased MR against 9.3.x.

paulocs’s picture

I 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.

paulocs’s picture

Status: Needs review » Reviewed & tested by the community
spokje’s picture

Thanks @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 from 9.3.x to get the Merge request !540 showing up in Green again.

spokje’s picture

catch’s picture

Status: Reviewed & tested by the community » Postponed

I think we should patch coder to be more permissive - coder should follow core coding standards rather than the other way around.

spokje’s picture

@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.

quietone’s picture

This 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?

quietone’s picture

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

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

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

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.

quietone’s picture

Issue summary: View changes
quietone’s picture

Title: Fix 'Drupal.Commenting.DocComment.ShortNotCapital' coding standard » Fix 'Drupal.Commenting.DocComment.ShortNotCapital' coding standard for callbacks
Issue summary: View changes

Revisiting this. I am still not sure about the postponing of this issue. The standard states

All summaries (first lines of docblocks) must be under 80 characters, start with a capital letter, and end with a period (.).

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.

quietone’s picture

Issue summary: View changes
quietone’s picture

Issue summary: View changes
Status: Postponed » Needs review
borisson_’s picture

Looks like the last run on the merge request has some remaining failures, but I also have a question (posted on the MR).

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new42.33 KB

The 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.

quietone’s picture

Issue summary: View changes
Status: Needs work » Needs review

The 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.

borisson_’s picture

Looks like the standard is indeed clear, but I didn't know that part of it, so for me this looks good.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Actually, I think I can rtbc this, as long as the committers know this can only be committed after the sibling issue.

nod_’s picture

Status: Reviewed & tested by the community » Needs work

committed sibling issue, merge conflict to resolve now :)

quietone’s picture

Issue summary: View changes
Status: Needs work » Needs review

Rebased 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

quietone’s picture

Issue summary: View changes
borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Ok, back to rtbc it goes.

  • nod_ committed 52e18ccf on 11.x
    Issue #2903027 by spokje, jofitz, quietone, savkaviktor16@gmail.com,...
nod_’s picture

Status: Reviewed & tested by the community » Fixed

Committed 52e18cc and pushed to 11.x. Thanks!

quietone’s picture

There is a mistake in this commit, in ohpcs.xml.idst. Instead of adding this,

  <rule ref="Drupal.Commenting.DocComment">
    <exclude-pattern>core/tests/*</exclude-pattern>
  </rule>

it should have been

<rule ref="Drupal.Commenting.DocComment.DocComment.ShortNotCapital">
    <exclude-pattern>core/tests/*</exclude-pattern>
</rule>

Maybe this can be resolved in #3511759: Enable 'Drupal.Commenting.DocComment.ShortNotCapital' coding standard ?

Status: Fixed » Closed (fixed)

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