Drupal Coding Standards Issues | phpcs

Created on 30 December 2022, over 1 year ago
Updated 19 May 2023, about 1 year ago

Problem/Motivation

Getting following error/warnings

FILE: /app/modules/contrib/sitewide_alert/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 21 WARNINGS AFFECTING 21 LINES
----------------------------------------------------------------------
4 | WARNING | Line exceeds 80 characters; contains 82 characters
6 | WARNING | Line exceeds 80 characters; contains 115 characters
12 | WARNING | Line exceeds 80 characters; contains 107 characters
13 | WARNING | Line exceeds 80 characters; contains 96 characters
15 | WARNING | Line exceeds 80 characters; contains 118 characters
17 | WARNING | Line exceeds 80 characters; contains 83 characters
18 | WARNING | Line exceeds 80 characters; contains 120 characters
20 | WARNING | Line exceeds 80 characters; contains 111 characters
21 | WARNING | Line exceeds 80 characters; contains 119 characters
34 | WARNING | Line exceeds 80 characters; contains 95 characters
36 | WARNING | Line exceeds 80 characters; contains 126 characters
37 | WARNING | Line exceeds 80 characters; contains 120 characters
40 | WARNING | Line exceeds 80 characters; contains 104 characters
46 | WARNING | Line exceeds 80 characters; contains 122 characters
57 | WARNING | Line exceeds 80 characters; contains 85 characters
59 | WARNING | Line exceeds 80 characters; contains 119 characters
66 | WARNING | Line exceeds 80 characters; contains 117 characters
67 | WARNING | Line exceeds 80 characters; contains 121 characters
68 | WARNING | Line exceeds 80 characters; contains 114 characters
71 | WARNING | Line exceeds 80 characters; contains 119 characters
88 | WARNING | Line exceeds 80 characters; contains 117 characters
----------------------------------------------------------------------

FILE: /app/modules/contrib/sitewide_alert/sitewide_alert.install
--------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------------------------------------------
15 | WARNING | Line exceeds 80 characters; contains 91 characters
31 | WARNING | Line exceeds 80 characters; contains 85 characters
59 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph
--------------------------------------------------------------------------------------------------------------------

FILE: /app/modules/contrib/sitewide_alert/src/AlertStyleProvider.php
----------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------
55 | WARNING | Only string literals should be passed to t() where possible
----------------------------------------------------------------------------

FILE: /app/modules/contrib/sitewide_alert/src/Controller/SitewideAlertController.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------------------------------------
123 | ERROR | [ ] The array declaration extends to column 150 (the limit is 80). The array content should be split up over multiple lines
162 | ERROR | [x] Array closing indentation error, expected 16 spaces but found 18
-------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------

FILE: /app/modules/contrib/sitewide_alert/src/Controller/SitewideAlertsController.php
-------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
-------------------------------------------------------------------------------------
24 | ERROR | Missing short description in doc comment
84 | WARNING | Line exceeds 80 characters; contains 86 characters
103 | WARNING | Line exceeds 80 characters; contains 87 characters
-------------------------------------------------------------------------------------

FILE: /app/modules/contrib/sitewide_alert/src/Form/SitewideAlertConfigForm.php
------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------
19 | ERROR | Missing short description in doc comment
------------------------------------------------------------------------------

FILE: /app/modules/contrib/sitewide_alert/src/Form/SitewideAlertRevisionDeleteForm.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------
124 | ERROR | The array declaration extends to column 178 (the limit is 80). The array content should be split up over multiple lines
125 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
125 | ERROR | The array declaration extends to column 244 (the limit is 80). The array content should be split up over multiple lines
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /app/modules/contrib/sitewide_alert/src/Form/SitewideAlertRevisionRevertForm.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------
139 | ERROR | The array declaration extends to column 179 (the limit is 80). The array content should be split up over multiple lines
140 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
140 | ERROR | The array declaration extends to column 235 (the limit is 80). The array content should be split up over multiple lines
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /app/modules/contrib/sitewide_alert/src/Plugin/Validation/Constraint/ScheduledDateProvidedConstraint.php
--------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------------------------------------
8 | WARNING | [x] Unused use statement
22 | WARNING | [ ] Line exceeds 80 characters; contains 93 characters
--------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------

FILE: /app/modules/contrib/sitewide_alert/src/SitewideAlertManager.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------
80 | WARNING | Line exceeds 80 characters; contains 85 characters
95 | WARNING | Line exceeds 80 characters; contains 87 characters
123 | WARNING | Line exceeds 80 characters; contains 112 characters
158 | WARNING | Line exceeds 80 characters; contains 112 characters
----------------------------------------------------------------------

FILE: /app/modules/contrib/sitewide_alert/src/SitewideAlertRenderer.php
-----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------
61 | WARNING | Line exceeds 80 characters; contains 115 characters
-----------------------------------------------------------------------

FILE: /app/modules/contrib/sitewide_alert/src/SitewideAlertRendererInterface.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
5 | ERROR | [x] There must be one blank line after the namespace declaration
25 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /app/modules/contrib/sitewide_alert/tests/src/Functional/SitewideAlertLimitTest.php
-----------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------
7 | WARNING | [x] Unused use statement
9 | WARNING | [x] Unused use statement
-----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------

Time: 2.66 secs; Memory: 14MB

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/sitewide_alert/

Proposed resolution

Above error/warnings need to be fixed

๐Ÿ› Bug report
Status

Closed: duplicate

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.

Production build 0.69.0 2024