Fix the issues reported by phpcs

Created on 3 August 2022, over 2 years ago
Updated 31 August 2023, over 1 year ago

Problem/Motivation

โฏ phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css,js .

FILE: /Users/specbee/Sites/Projects/sitewide_alert/js/init.es6.js
-------------------------------------------------------------------------------------------------
FOUND 41 ERRORS AFFECTING 25 LINES
-------------------------------------------------------------------------------------------------
   1 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
   4 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
   6 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
   9 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  18 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  22 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  31 | ERROR | [x] Expected 1 space before "-"; 0 found
  31 | ERROR | [x] Expected 1 space after "-"; 0 found
  31 | ERROR | [x] Expected 1 space before "-"; 0 found
  31 | ERROR | [x] Expected 1 space after "-"; 0 found
  32 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  36 | ERROR | [x] Expected 1 space before "-"; 0 found
  36 | ERROR | [x] Expected 1 space after "-"; 0 found
  36 | ERROR | [x] Expected 1 space before "-"; 0 found
  36 | ERROR | [x] Expected 1 space after "-"; 0 found
  45 | ERROR | [x] Expected 1 space before "-"; 0 found
  45 | ERROR | [x] Expected 1 space after "-"; 0 found
  45 | ERROR | [x] Expected 1 space before "-"; 0 found
  45 | ERROR | [x] Expected 1 space after "-"; 0 found
  48 | ERROR | [x] Expected 1 space before "-"; 0 found
  48 | ERROR | [x] Expected 1 space after "-"; 0 found
  48 | ERROR | [x] Expected 1 space before "="; 0 found
  48 | ERROR | [x] Expected 1 space after "="; 0 found
  51 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  52 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  74 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  75 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  85 | ERROR | [x] Expected 1 space before "/"; 0 found
  85 | ERROR | [x] Expected 1 space after "/"; 0 found
 132 | ERROR | [x] Expected 1 space before "-"; 0 found
 132 | ERROR | [x] Expected 1 space after "-"; 0 found
 132 | ERROR | [x] Expected 1 space before "="; 0 found
 132 | ERROR | [x] Expected 1 space after "="; 0 found
 144 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 145 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 159 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
 166 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
 174 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
 189 | ERROR | [x] Space before opening parenthesis of function call prohibited
 199 | ERROR | [x] Space before opening parenthesis of function call prohibited
 238 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
-------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 41 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/sitewide_alert/js/init.js
----------------------------------------------------------------------------------------------
FOUND 38 ERRORS AFFECTING 22 LINES
----------------------------------------------------------------------------------------------
   9 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  11 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  13 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  20 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  24 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  31 | ERROR | [x] Expected 1 space before "-"; 0 found
  31 | ERROR | [x] Expected 1 space after "-"; 0 found
  31 | ERROR | [x] Expected 1 space before "-"; 0 found
  31 | ERROR | [x] Expected 1 space after "-"; 0 found
  32 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  34 | ERROR | [x] Expected 1 space before "-"; 0 found
  34 | ERROR | [x] Expected 1 space after "-"; 0 found
  34 | ERROR | [x] Expected 1 space before "-"; 0 found
  34 | ERROR | [x] Expected 1 space after "-"; 0 found
  38 | ERROR | [x] Expected 1 space before "-"; 0 found
  38 | ERROR | [x] Expected 1 space after "-"; 0 found
  38 | ERROR | [x] Expected 1 space before "-"; 0 found
  38 | ERROR | [x] Expected 1 space after "-"; 0 found
  39 | ERROR | [x] Expected 1 space before "-"; 0 found
  39 | ERROR | [x] Expected 1 space after "-"; 0 found
  39 | ERROR | [x] Expected 1 space before "="; 0 found
  39 | ERROR | [x] Expected 1 space after "="; 0 found
  41 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  42 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  60 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  61 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  66 | ERROR | [x] Expected 1 space before "/"; 0 found
  66 | ERROR | [x] Expected 1 space after "/"; 0 found
  86 | ERROR | [x] Expected 1 space before "-"; 0 found
  86 | ERROR | [x] Expected 1 space after "-"; 0 found
  86 | ERROR | [x] Expected 1 space before "="; 0 found
  86 | ERROR | [x] Expected 1 space after "="; 0 found
  91 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  92 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 104 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
 107 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
 146 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 155 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 38 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/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
--------------------------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/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: /Users/specbee/Sites/Projects/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: /Users/specbee/Sites/Projects/sitewide_alert/src/SitewideAlertRenderer.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 61 | WARNING | Line exceeds 80 characters; contains 115 characters
--------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/sitewide_alert/src/Form/SitewideAlertConfigForm.php
---------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------
 19 | ERROR | Missing short description in doc comment
---------------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/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: /Users/specbee/Sites/Projects/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: /Users/specbee/Sites/Projects/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: /Users/specbee/Sites/Projects/sitewide_alert/src/Plugin/Validation/Constraint/LimitToPagesConstraintValidator.php
-----------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------
 36 | ERROR | Missing parameter comment
 36 | ERROR | Missing parameter type
 38 | ERROR | Description for the @return value is missing
-----------------------------------------------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/sitewide_alert/src/Plugin/Validation/Constraint/LimitToPagesConstraint.php
------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------
 20 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph
------------------------------------------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/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: /Users/specbee/Sites/Projects/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: /Users/specbee/Sites/Projects/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: /Users/specbee/Sites/Projects/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: /Users/specbee/Sites/Projects/sitewide_alert/src/SitewideAlertManager.php
-------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
-------------------------------------------------------------------------------
 116 | WARNING | Line exceeds 80 characters; contains 85 characters
 131 | WARNING | Line exceeds 80 characters; contains 87 characters
 159 | WARNING | Line exceeds 80 characters; contains 112 characters
 194 | WARNING | Line exceeds 80 characters; contains 112 characters
-------------------------------------------------------------------------------

Time: 710ms; Memory: 14MB

Steps to reproduce

Run following command
phpcs --standard=โ€œDrupal,DrupalPracticeโ€ --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css,js .

๐Ÿ“Œ Task
Status

Fixed

Version

2.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia Rakhi Soni

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

Not all content is available!

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

Production build 0.71.5 2024