Drupal Coding Standards Issues | phpcs

Created on 27 February 2023, over 1 year ago
Updated 21 March 2023, over 1 year ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/views_timelinejs/views_timelinejs.module
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
221 | ERROR | All functions defined in a module file must be prefixed with the module's name, found "_sanitize_timeline_options" but expected
| | "views_timelinejs__sanitize_timeline_options"
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/views_timelinejs/src/Plugin/views/style/TimelineJS.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AND 2 WARNINGS AFFECTING 7 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
5 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
6 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
18 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
373 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
540 | WARNING | [x] '@todo: Implement a logger.' should match the format '@todo Fix problem X here.'
541 | ERROR | [ ] The array declaration extends to column 241 (the limit is 80). The array content should be split up over multiple lines
779 | ERROR | [ ] The array declaration extends to column 229 (the limit is 80). The array content should be split up over multiple lines
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/views_timelinejs/src/TimelineJS/Date.php
-------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------------
5 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
6 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
7 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
-------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------

Time: 1.93 secs; Memory: 10MB

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

Proposed resolution

Above error/warnings need to be fixed.

📌 Task
Status

Fixed

Version

4.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