Drupal Coding Standards Issues | phpcs

Created on 13 December 2022, almost 2 years ago
Updated 27 January 2023, almost 2 years ago

Problem/Motivation

Getting following error/warnings

FILE: /app/modules/contrib/lang_dropdown/lang_dropdown.module
-------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 17 WARNINGS AFFECTING 17 LINES
-------------------------------------------------------------------------------------
12 | WARNING | Global constants should not be used, move it to a class or interface
13 | WARNING | Global constants should not be used, move it to a class or interface
14 | WARNING | Global constants should not be used, move it to a class or interface
15 | WARNING | Global constants should not be used, move it to a class or interface
16 | WARNING | Global constants should not be used, move it to a class or interface
19 | WARNING | Global constants should not be used, move it to a class or interface
20 | WARNING | Global constants should not be used, move it to a class or interface
21 | WARNING | Global constants should not be used, move it to a class or interface
22 | WARNING | Global constants should not be used, move it to a class or interface
25 | WARNING | Global constants should not be used, move it to a class or interface
26 | WARNING | Global constants should not be used, move it to a class or interface
27 | WARNING | Global constants should not be used, move it to a class or interface
28 | WARNING | Global constants should not be used, move it to a class or interface
31 | WARNING | Global constants should not be used, move it to a class or interface
32 | WARNING | Global constants should not be used, move it to a class or interface
35 | WARNING | Global constants should not be used, move it to a class or interface
36 | WARNING | Global constants should not be used, move it to a class or interface
-------------------------------------------------------------------------------------

FILE: /app/modules/contrib/lang_dropdown/src/Form/LanguageDropdownForm.php
--------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 3 WARNINGS AFFECTING 7 LINES
--------------------------------------------------------------------------------------------------
26 | ERROR | [ ] Missing member variable doc comment
27 | ERROR | [ ] Missing member variable doc comment
28 | ERROR | [ ] Missing member variable doc comment
93 | ERROR | [x] Parameter comment must end with a full stop
162 | WARNING | [ ] Only string literals should be passed to t() where possible
176 | WARNING | [ ] Only string literals should be passed to t() where possible
214 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------

FILE: /app/modules/contrib/lang_dropdown/src/Plugin/Block/LanguageDropdownBlock.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AND 1 WARNING AFFECTING 7 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
305 | ERROR | [ ] The array declaration extends to column 91 (the limit is 80). The array content should be split up over multiple lines
334 | ERROR | [ ] The array declaration extends to column 327 (the limit is 80). The array content should be split up over multiple lines
437 | ERROR | [ ] The array declaration extends to column 295 (the limit is 80). The array content should be split up over multiple lines
720 | ERROR | [x] list(...) is forbidden, use [...] instead.
725 | ERROR | [x] list(...) is forbidden, use [...] instead.
769 | ERROR | [x] list(...) is forbidden, use [...] instead.
799 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------

FILE: /app/modules/contrib/lang_dropdown/tests/src/Functional/LanguageSwitchingTest.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
54 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
62 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------

Time: 1.91 secs; Memory: 16MB

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

Proposed resolution

bove error/warnings need to be fixed

๐Ÿ› Bug report
Status

RTBC

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.71.5 2024