Problem/Motivation
To get the security advisory coverage, the php code sniffer is used to improve some code syntax.
Link to Issue →
After the installation and execution of the command
phpcs --standard=Drupal,DrupalPractice web/modules/contrib/ckeditor5_template/
we get following output:
FILE: /var/www/html/docport/web/modules/contrib/ckeditor5_template/src/Plugin/CKEditor5Plugin/Template.php
---------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 12 ERRORS AND 3 WARNINGS AFFECTING 14 LINES
---------------------------------------------------------------------------------------------------------------------------------------------------------------
10 | WARNING | [x] Unused use statement
12 | ERROR | [x] There must be one blank line after the last USE statement; 2 found;
15 | ERROR | [x] Missing class doc comment
18 | ERROR | [x] Whitespace found at end of line
20 | ERROR | [x] Expected 3 space(s) before asterisk; 1 found
21 | ERROR | [x] Expected 3 space(s) before asterisk; 1 found
22 | ERROR | [x] Expected 3 space(s) before asterisk; 1 found
23 | ERROR | [x] Expected 3 space(s) before asterisk; 1 found
31 | WARNING | [ ] #description values usually have to run through t() for translation
36 | ERROR | [x] Expected 1 blank line after function; 2 found
46 | ERROR | [x] Expected 1 blank line after function; 2 found
54 | ERROR | [x] Expected 1 blank line after function; 2 found
70 | WARNING | [x] A comma should follow the last multiline array item. Found: '/modules/contrib/ckeditor5_template/template/ckeditor5_template.json.example'
73 | ERROR | [x] Expected 1 newline at end of file; 0 found
73 | ERROR | [x] The closing brace for the class must have an empty line before it
---------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 14 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/docport/web/modules/contrib/ckeditor5_template/js/ckeditor5_plugins/template/src/template.js
----------------------------------------------------------------------------------------------------------------
FOUND 15 ERRORS AFFECTING 14 LINES
----------------------------------------------------------------------------------------------------------------
10 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
16 | ERROR | [x] Whitespace found at end of line
17 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
22 | 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"
35 | ERROR | [x] Space before opening parenthesis of function call prohibited
36 | ERROR | [x] Space before opening parenthesis of function call prohibited
37 | ERROR | [x] Whitespace found at end of line
38 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
38 | ERROR | [x] Whitespace found at end of line
53 | ERROR | [x] Space before opening parenthesis of function call prohibited
61 | ERROR | [x] Whitespace found at end of line
63 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
64 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
69 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 15 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/docport/web/modules/contrib/ckeditor5_template/js/template.js
---------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------
1 | WARNING | File appears to be minified and cannot be processed
---------------------------------------------------------------------------------
FILE: /var/www/html/docport/web/modules/contrib/ckeditor5_template/css/layout.css
---------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 3 LINES
---------------------------------------------------------------------------------
2 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
2 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
3 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
3 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
4 | ERROR | [x] Expected 1 newline at end of file; 0 found
---------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------
FILE: /var/www/html/docport/web/modules/contrib/ckeditor5_template/css/admin.css
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | ERROR | [x] Additional whitespace found at start of file
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: /var/www/html/docport/web/modules/contrib/ckeditor5_template/webpack.config.js
---------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
---------------------------------------------------------------------------------------------
20 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
25 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
29 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
---------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------
Time: 300ms; Memory: 10MB
Steps to reproduce
Install phpcs and run phpcs --standard=Drupal,DrupalPractice web/modules/contrib/ckeditor5_template/
Proposed resolution
No more entries
Remaining tasks
Fix errors and warnings using the instructions.
Using the PHPCBF (PHP Code Beautifier and Fixer) might be helpful.