Fix phpcs Drupal.Commenting issues

Created on 1 January 2024, 6 months ago
Updated 20 June 2024, 3 days ago

Problem/Motivation

Fix phpcs errors for

  • Drupal.Commenting.DocComment
  • Drupal.Commenting.FunctionComment
  • Drupal.Commenting.InlineVariableComment
  • Drupal.Commenting.ClassComment
  • Drupal.Commenting.DataTypeNamespace
  • Drupal.Commenting.Deprecated
  • Drupal.Commenting.FileComment
  • Drupal.Commenting.InlineComment

Command:

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,twig modules/custom/pathauto/ --sniffs="Drupal.Commenting.DocComment,Drupal.Commenting.FunctionComment,Drupal.Commenting.InlineVariableComment,Drupal.Commenting.ClassComment,Drupal.Commenting.DataTypeNamespace,Drupal.Commenting.Deprecated,Drupal.Commenting.FileComment,Drupal.Commenting.InlineComment"

Result:


FILE: /tests/modules/pathauto_custom_punctuation_test/pathauto_custom_punctuation_test.module
-------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------
 1 | ERROR | [x] Missing file doc comment
-------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------


FILE: /tests/src/Functional/PathautoNodeWebTest.php
--------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------
 182 | ERROR | Missing short description in doc comment
--------------


FILE: /tests/src/Functional/PathautoBulkUpdateTest.php
-----------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------
 73 | ERROR | [x] Missing function doc comment
-----------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------


FILE: /tests/src/Functional/PathautoEnablingEntityTypesTest.php
---
FOUND 1 ERROR AFFECTING 1 LINE
---
 61 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph
---


FILE: /tests/src/Kernel/PathautoTokenTest.php
--------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------
  23 | ERROR   | [x] Missing function doc comment
  39 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
 124 | ERROR   | [x] Missing function doc comment
--------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------


FILE: /tests/src/Kernel/PathautoEntityWithStringIdTest.php
---------------------
FOUND 2 ERRORS AFFECTING 2 LINES
---------------------
 78 | ERROR | [ ] Parameter tags must be defined first in a doc comment
 79 | ERROR | [x] Parameter comment must end with a full stop
---------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------


FILE: /tests/src/FunctionalJavascript/PathautoLocaleTest.php
---
FOUND 1 ERROR AFFECTING 1 LINE
---
 45 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph
---


FILE: /tests/src/FunctionalJavascript/PathautoUiTest.php
-------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-------------------
 60 | ERROR | [x] Missing function doc comment
 70 | ERROR | [x] Missing function doc comment
-------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------


FILE: /pathauto.api.php
---------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------
 10 | ERROR | Missing short description in doc comment
---------------------------------


FILE: /pathauto.module
----
FOUND 1 ERROR AFFECTING 1 LINE
----
 151 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph
----


FILE: /src/PathautoGeneratorInterface.php
-------
FOUND 10 ERRORS AFFECTING 7 LINES
-------
 13 | ERROR | [ ] Doc comment short description must start with a capital letter
 13 | ERROR | [ ] Doc comment short description must end with a full stop
 18 | ERROR | [ ] Doc comment short description must start with a capital letter
 18 | ERROR | [ ] Doc comment short description must end with a full stop
 23 | ERROR | [ ] Doc comment short description must start with a capital letter
 23 | ERROR | [ ] Doc comment short description must end with a full stop
 53 | ERROR | [ ] Description for the @return value is missing
 76 | ERROR | [x] Data types in @param tags need to be fully namespaced
 81 | ERROR | [ ] Parameter comment must start with a capital letter
 82 | ERROR | [x] Parameter comment must end with a full stop
-------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------


FILE: /src/Entity/PathautoPattern.php

FOUND 4 ERRORS AFFECTING 4 LINES

 101 | ERROR | [ ] Missing short description in doc comment
 127 | ERROR | [ ] Missing short description in doc comment
 132 | ERROR | [ ] Missing short description in doc comment
 410 | ERROR | [x] Parameter comment must end with a full stop

PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY



FILE: /src/Form/PatternEditForm.php
-----------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------
  25 | ERROR | [ ] Missing short description in doc comment
 112 | ERROR | [x] Inline comments must start with a capital letter
-----------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------


FILE: /src/Plugin/Deriver/EntityAliasTypeDeriver.php
---------------
FOUND 2 ERRORS AFFECTING 2 LINES
---------------
 23 | ERROR | Missing short description in doc comment
 35 | ERROR | Missing short description in doc comment
---------------


FILE: /src/Plugin/pathauto/AliasType/EntityAliasTypeBase.php

FOUND 2 ERRORS AFFECTING 1 LINE

 300 | ERROR | The text '@deprecated Use \Drupal\pathauto\PathautoState::bulkDelete() instead.' does not match the standard format: @deprecated in %deprecation-version% and is removed from %removal-version%. %extra-info%.
 300 | ERROR | Each @deprecated tag must have a @see tag immediately following it



FILE: /src/EventSubscriber/PathautoSettingsCacheTag.php
------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------
 16 | ERROR | Missing short description in doc comment
------------------


FILE: /src/AliasStorageHelperInterface.php
-----
FOUND 1 ERROR AFFECTING 1 LINE
-----
 105 | ERROR | Missing parameter type
-----


FILE: /src/PathautoFieldItemList.php
------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
------------------------------------
  7 | ERROR | [x] Missing class doc comment
  9 | ERROR | [ ] Missing short description in doc comment
 29 | ERROR | [ ] Missing short description in doc comment
------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------


FILE: /src/PathautoState.php
---------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
---------------------------------
  30 | ERROR | Missing short description in doc comment
 123 | ERROR | Description for the @return value is missing
---------------------------------


FILE: /src/PathautoPatternInterface.php
--
FOUND 11 ERRORS AFFECTING 11 LINES
--
  15 | ERROR | Description for the @return value is missing
  22 | ERROR | Missing parameter comment
  31 | ERROR | Description for the @return value is missing
  35 | ERROR | Missing short description in doc comment
  36 | ERROR | Description for the @return value is missing
  43 | ERROR | Description for the @return value is missing
  60 | ERROR | Description for the @return value is missing
 128 | ERROR | Description for the @return value is missing
 149 | ERROR | Description for the @return value is missing
 174 | ERROR | Missing parameter type
 177 | ERROR | Description for the @return value is missing
--


FILE: /src/PathautoPatternListBuilder.php
----
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----
 40 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
----
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----


FILE: /src/AliasCleanerInterface.php
------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------
 5 | ERROR | Missing short description in doc comment
------------------------------------


FILE: /src/Commands/PathautoCommands.php
--------
FOUND 11 ERRORS AFFECTING 11 LINES
--------
  65 | ERROR | [ ] Doc comment short description must start with a capital letter
  69 | ERROR | [ ] Parameter tags must be defined first in a doc comment
 107 | ERROR | [ ] Parameter $options is not described in comment
 108 | ERROR | [x] Doc comment short description must end with a full stop
 112 | ERROR | [ ] Parameter tags must be defined first in a doc comment
 170 | ERROR | [ ] Missing short description in doc comment
 183 | ERROR | [ ] Missing short description in doc comment
 197 | ERROR | [ ] Missing short description in doc comment
 201 | ERROR | [ ] @throws tag comment must end with a full stop
 216 | ERROR | [ ] Missing short description in doc comment
 220 | ERROR | [ ] @throws tag comment must end with a full stop
--------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @zniki.ru
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Anjali Mehta

    Anjali Mehta โ†’ made their first commit to this issueโ€™s fork.

  • First commit to issue fork.
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 5.7
    last update 6 months ago
    48 pass
  • Status changed to Needs review 6 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sakthi_dev

    Please review.

  • Pipeline finished with Failed
    6 months ago
    Total: 385s
    #70568
  • Status changed to Needs work 6 months ago
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    Thanks for you contribution, I didn't check changes yet.
    There are 2 issues left in the tests/src/Functional/PathautoBulkUpdateTest.php.

    FILE: ...es/custom/pathauto-3411808/tests/src/Functional/PathautoBulkUpdateTest.php
    --------------------------------------------------------------------------------
     20 | ERROR   | [x] Expected 2 space(s) before asterisk; 3 found
        |         |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
     21 | ERROR   | [x] Expected 2 space(s) before asterisk; 3 found
        |         |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
    

    Source https://git.drupalcode.org/issue/pathauto-3411808/-/jobs/558800

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 5.7
    last update 6 months ago
    48 pass
  • Pipeline finished with Failed
    6 months ago
    #70890
  • Status changed to Needs review 6 months ago
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    All Drupal.Commenting violations fixed. List of fixed sniffs:

    [ ] Drupal.Commenting.DocComment.MissingShort                    18
    [ ] Drupal.Commenting.FunctionComment.MissingReturnComment       10
    [x] Drupal.Commenting.FunctionComment.Missing                    5
    [ ] Drupal.Commenting.DocComment.ShortFullStop                   4
    [ ] Drupal.Commenting.DocComment.ShortNotCapital                 4
    [ ] Drupal.Commenting.DocComment.ParamNotFirst                   3
    [ ] Drupal.Commenting.DocComment.ShortSingleLine                 3
    [x] Drupal.Commenting.FunctionComment.ParamCommentFullStop       3
    [x] Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar        2
    [ ] Drupal.Commenting.FunctionComment.MissingParamType           2
    [ ] Drupal.Commenting.FunctionComment.ThrowsNoFullStop           2
    [x] Drupal.Commenting.InlineVariableComment.VarInline            2
    [x] Drupal.Commenting.ClassComment.Missing                       1
    [x] Drupal.Commenting.DataTypeNamespace.DataTypeNamespace        1
    [ ] Drupal.Commenting.Deprecated.DeprecatedMissingSeeTag         1
    [ ] Drupal.Commenting.Deprecated.IncorrectTextLayout             1
    [x] Drupal.Commenting.FileComment.Missing                        1
    [ ] Drupal.Commenting.FunctionComment.MissingParamComment        1
    [ ] Drupal.Commenting.FunctionComment.ParamCommentNotCapital     1
    [ ] Drupal.Commenting.FunctionComment.ParamMissingDefinition     1
    [x] Drupal.Commenting.InlineComment.NotCapital                   1
    

    MR is ready for review.

  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland Berdir Switzerland

    Tests are currently failing, I will not commit low prio things like coding standard fixes until they pass again. The test fails are likely caused by Drupal 10.2 changes. I suggest opening a separate issue to investigate and fix those first.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 5.7
    last update 6 months ago
    48 pass
  • Pipeline finished with Failed
    6 months ago
    Total: 355s
    #71437
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 5.7
    last update 6 months ago
    48 pass
  • Pipeline finished with Failed
    6 months ago
    Total: 303s
    #71443
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 5 months ago
    48 pass
  • Pipeline finished with Failed
    5 months ago
    Total: 422s
    #75928
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 5 months ago
    48 pass
  • Pipeline finished with Success
    5 months ago
    Total: 372s
    #75939
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    Tests fixed now, ready for review.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 5 months ago
    48 pass
  • Pipeline finished with Success
    5 months ago
    Total: 389s
    #79097
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    Update MR, add phpcs.xml file and exclude rules that will be fixed in different issues.
    Gitlab CI check phpcs passed.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 5 months ago
    48 pass
  • Pipeline finished with Success
    5 months ago
    Total: 408s
    #80009
  • Status changed to Needs work 5 months ago
  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland Berdir Switzerland
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 5 months ago
    48 pass
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sakthi_dev

    Addressed some comments in MR. Please fix others.

  • Pipeline finished with Success
    5 months ago
    Total: 336s
    #84866
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    Update phpcs report.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 5 months ago
    48 pass
  • Pipeline finished with Success
    5 months ago
    Total: 362s
    #85019
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 5 months ago
    48 pass
  • Pipeline finished with Canceled
    5 months ago
    Total: 201s
    #85027
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 5 months ago
    48 pass
  • Pipeline finished with Success
    5 months ago
    Total: 444s
    #85028
  • Assigned to akshaydalvi212
  • Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 3 months ago
    Not currently mergeable.
  • Issue was unassigned.
  • Status changed to Needs review 3 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia akshaydalvi212

    Resolved the remaining phpcs issues.
    kindly review.

  • Pipeline finished with Success
    3 months ago
    Total: 358s
    #134462
  • Assigned to zniki.ru
  • Status changed to Needs work 3 days ago
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    @akshaydalvi212 thanks for your contribution, this issue is only about to fix Drupal.Commenting violations.
    I will revert commit b043409c, because it contains changes not related to these cs rules.
    And I will resolve merge conflict.

  • Pipeline finished with Success
    3 days ago
    Total: 165s
    #203441
  • Pipeline finished with Success
    3 days ago
    Total: 165s
    #203501
  • Pipeline finished with Success
    3 days ago
    Total: 170s
    #203552
  • Pipeline finished with Success
    3 days ago
    Total: 205s
    #203565
  • Issue was unassigned.
  • Status changed to Needs review 3 days ago
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    Resolve Merge conflict and update some comments. Ready for review.

    During review please take a closer look at order of @hook, @throws, @annotation in src/Commands/PathautoCommands.php not sure, that this is correct order, welcome for suggestion.

    And I don't know how to fix "Missing short description in doc comment" at pathauto.api.php:10. This is last one from Drupal.Commenting in code base for now,

    CS Report updated in the IS.

Production build 0.69.0 2024