Drupal Coding Standards Issues | phpcs

Created on 24 January 2023, almost 2 years ago
Updated 16 November 2023, about 1 year ago

Problem/Motivation

FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/notification_message/notification_message.install
--------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
--------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
28 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
38 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
41 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
42 | ERROR | [x] Closing parenthesis of array declaration must be on a new line
--------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------

FILE: ....1.x/drupal/modules/contrib/notification_message/tests/modules/notification_message_ui_test/notification_message_ui_test.routing.yml
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------
6 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/notification_message/notification_message.module
-------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 3 WARNINGS AFFECTING 5 LINES
-------------------------------------------------------------------------------------------------------------------------
22 | WARNING | [x] A comma should follow the last multiline array item. Found: 'notification-message'
28 | WARNING | [x] A comma should follow the last multiline array item. Found: 'notification-messages'
29 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
108 | ERROR | [ ] Description for the @return value is missing
109 | ERROR | [x] Separate the @return and @throws sections by a blank line.
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------

FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/notification_message/README.md
-------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 15 WARNINGS AFFECTING 15 LINES
-------------------------------------------------------------------------------------------------------
4 | WARNING | Line exceeds 80 characters; contains 394 characters
6 | WARNING | Line exceeds 80 characters; contains 220 characters
29 | WARNING | Line exceeds 80 characters; contains 219 characters
35 | WARNING | Line exceeds 80 characters; contains 152 characters
39 | WARNING | Line exceeds 80 characters; contains 97 characters
41 | WARNING | Line exceeds 80 characters; contains 107 characters
43 | WARNING | Line exceeds 80 characters; contains 166 characters
45 | WARNING | Line exceeds 80 characters; contains 300 characters
47 | WARNING | Line exceeds 80 characters; contains 107 characters
52 | WARNING | Line exceeds 80 characters; contains 156 characters
54 | WARNING | Line exceeds 80 characters; contains 229 characters
56 | WARNING | Line exceeds 80 characters; contains 313 characters
58 | WARNING | Line exceeds 80 characters; contains 120 characters
60 | WARNING | Line exceeds 80 characters; contains 100 characters
62 | WARNING | Line exceeds 80 characters; contains 244 characters
-------------------------------------------------------------------------------------------------------

FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/notification_message/templates/notification_message.theme
----------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------------------------
13 | ERROR | Missing parameter type
42 | ERROR | Missing parameter type
----------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/notification_message/src/Form/NotificationMessageTypeForm.php
--------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------
20 | ERROR | Missing short description in doc comment
--------------------------------------------------------------------------------------------------------------------------------------

FILE: ...sers/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/notification_message/src/Form/NotificationMessageTypeDeleteForm.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------
14 | ERROR | [ ] Doc comment short description must start with a capital letter
14 | ERROR | [x] Doc comment short description must end with a full stop
------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/notification_message/src/Form/NotificationMessageForm.php
----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------------------------
144 | ERROR | [x] Data types in @var tags need to be fully namespaced
247 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/notification_message/src/Form/NotificationMessageDeleteForm.php
----------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Missing class doc comment
----------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------

FILE: ...s/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/notification_message/src/Cache/Context/RouteEntityUuidCacheContext.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------------------------------
33 | ERROR | [ ] Parameter $entity_type_manager is not described in comment
92 | ERROR | [x] Expected 1 blank line after function; 0 found
93 | ERROR | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/notification_message/src/Entity/NotificationMessageStorage.php
---------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
---------------------------------------------------------------------------------------------------------------------------------------
12 | ERROR | [x] Missing class doc comment
24 | ERROR | [ ] Missing short description in doc comment
25 | ERROR | [ ] Missing parameter comment
---------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/notification_message/src/Entity/NotificationMessageInterface.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
35 | ERROR | Type hint "null" missing for $langcode
48 | ERROR | Missing parameter type
59 | ERROR | Missing parameter type
-----------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/notification_message/src/Entity/NotificationMessageAccess.php
--------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------
30 | ERROR | [x] Expected newline after closing brace
--------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/notification_message/src/Entity/NotificationMessage.php
--------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------------------------------------------------------
42 | WARNING | Line exceeds 80 characters; contains 85 characters
404 | WARNING | Unused variable $name.
523 | ERROR | Description for the @return value is missing
--------------------------------------------------------------------------------------------------------------------------------

FILE: ...yal/Documents/MySites/10.1.x/drupal/modules/contrib/notification_message/src/Entity/Routing/NotificationMessageHtmlRouteProvider.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------
21 | ERROR | [x] Expected 1 blank line after function; 0 found
22 | ERROR | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------

FILE: ...Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/notification_message/src/Plugin/Block/NotificationMessageBlock.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------------------------------
43 | ERROR | [ ] Missing short description in doc comment
182 | WARNING | [x] A comma should follow the last multiline array item. Found: )
250 | ERROR | [x] Expected newline after closing brace
------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------

Steps to reproduce

Run the following command : phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml /drupal/modules/contrib/notification_message

Proposed resolution

the remove the coding standard issues.

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia sahil.goyal

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

Comments & Activities

  • Issue created by @sahil.goyal
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sahil.goyal

    fixing the phpcs warnings and errors, still there are some phpcs errors shows which remain still because those making the code hard to readble.

  • Status changed to Needs review almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Charchil Khandelwal

    Charchil Khandelwal โ†’ made their first commit to this issueโ€™s fork.

  • Assigned to Charchil Khandelwal
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Charchil Khandelwal

    I will review this.

  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Charchil Khandelwal

    FILE: ...drupal\modules\notification_message\notification_message.install
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
    3 | ERROR | Missing short description in doc comment
    ----------------------------------------------------------------------

    FILE: ...cation_message\src\Cache\Context\RouteEntityUuidCacheContext.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
    38 | ERROR | Doc comment for parameter $request_stack does not match
    | | actual variable name
    ----------------------------------------------------------------------

    FILE: ...\modules\notification_message\src\Entity\NotificationMessage.php
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    ----------------------------------------------------------------------
    42 | WARNING | Line exceeds 80 characters; contains 85 characters
    404 | WARNING | Unused variable $name.
    ----------------------------------------------------------------------

    FILE: ...notification_message\src\Entity\NotificationMessageInterface.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
    35 | ERROR | Type hint "null" missing for $langcode
    ----------------------------------------------------------------------

    FILE: ...odules\notification_message\src\Form\NotificationMessageForm.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
    38 | ERROR | Doc comment is empty
    ----------------------------------------------------------------------

    FILE: ...ication_message_ui_test\notification_message_ui_test.routing.yml
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
    6 | WARNING | Open page callback found, please add a comment before
    | | the line why there is no access restriction
    ----------------------------------------------------------------------

    Need to fix these errors.

  • @charchil-khandelwal opened merge request.
  • @charchil-khandelwal opened merge request.
  • Issue was unassigned.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Charchil Khandelwal

    Some warnings and errors are fixed now.
    Also created MR !5 for same.
    Please review.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Ashutosh Ahirwal India

    Ashutosh Ahirwal โ†’ made their first commit to this issueโ€™s fork.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7
    last update over 1 year ago
    3 pass
  • @ashutosh-ahirwal opened merge request.
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Ashutosh Ahirwal India

    Created MR15 for fixes of phpcs-issue.

  • Status changed to Fixed about 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States asherry

    Thank you for this, this is helpful. I made some tweaks that should probably be properly exempted but the rest is committed.

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

Production build 0.71.5 2024