Drupal Coding Standards Issues | phpcs

Created on 18 January 2023, over 1 year ago

Problem/Motivation

Getting following error/warnings

FILE: /var/www/html/modules/contrib/unpublished_nodes_redirect/tests/src/Unit/UnpublishedNodesRedirectTest.php
--------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------------------------------------
16 | ERROR | [x] Doc comment short description must end with a full stop
23 | ERROR | [x] Doc comment short description must end with a full stop
--------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/unpublished_nodes_redirect/unpublished_nodes_redirect.install
-------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
34 | ERROR | [x] Doc comment short description must end with a full stop
38 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/unpublished_nodes_redirect/src/Form/UnpublishedNodesRedirectForm.php
----------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------------
14 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
123 | ERROR | [x] Use null coalesce operator instead of ternary operator.
----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/unpublished_nodes_redirect/src/UnpublishedNodesRedirectHtmlRouteProvider.php
----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------
7 | WARNING | [x] Unused use statement
23 | WARNING | [x] There must be no blank line following an inline comment
23 | WARNING | [ ] There must be no blank line following an inline comment
----------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/unpublished_nodes_redirect/src/Utils/UnpublishedNodesRedirectUtils.php
----------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------
39 | ERROR | Description for the @return value is missing
----------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/unpublished_nodes_redirect/src/EventSubscriber/UnpublishedNodesRedirectOn403Subscriber.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AND 1 WARNING AFFECTING 6 LINES
------------------------------------------------------------------------------------------------------------------------------
13 | WARNING | [x] Unused use statement
44 | ERROR | [x] Doc comment short description must end with a full stop
54 | ERROR | [x] Expected 1 blank line before function; 2 found
75 | ERROR | [x] Expected 1 blank line after function; 2 found
81 | ERROR | [ ] Missing parameter comment
83 | ERROR | [ ] The @see reference should not contain any additional text
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------

Time: 2.59 secs; Memory: 6MB

Steps to reproduce

Run following command

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/unpublished_nodes_redirect/

Proposed resolution

Above error/warnings need to be fixed.

🐛 Bug report
Status

RTBC

Version

2.0

Component

Code

Created by

🇮🇳India samit.310@gmail.com

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Assigned to Sonal Gyanani
  • Issue was unassigned.
  • Status changed to RTBC over 1 year ago
Production build 0.71.5 2024