Drupal Coding Standards Issues | phpcs

Created on 18 January 2023, almost 2 years ago
Updated 19 January 2023, almost 2 years ago

Problem/Motivation

Getting following error/warnings

FILE: /var/www/html/modules/contrib/dblog_filter/dblog_filter.info.yml
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
-------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/dblog_filter/dblog_filter.routing.yml
-------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------
7 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/dblog_filter/src/Form/DBLogFilterSettingsForm.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 49 ERRORS AND 8 WARNINGS AFFECTING 26 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
11 | ERROR | [x] Missing class doc comment
16 | WARNING | [ ] Possible useless method overriding detected
48 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
48 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
49 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
49 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
49 | WARNING | [ ] Unused variable $key.
50 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
50 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 3
51 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
51 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 3
52 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
52 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
53 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
53 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
53 | ERROR | [x] Short array syntax must be used to define arrays
54 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
54 | ERROR | [x] Line indented incorrectly; expected at least 4 spaces, found 3
54 | ERROR | [x] Array indentation error, expected 4 spaces but found 3
55 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
55 | ERROR | [x] Line indented incorrectly; expected at least 4 spaces, found 3
55 | ERROR | [x] Array indentation error, expected 4 spaces but found 3
55 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
56 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
56 | ERROR | [x] Line indented incorrectly; expected at least 4 spaces, found 3
56 | ERROR | [x] Array indentation error, expected 4 spaces but found 3
56 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
57 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
57 | ERROR | [x] Line indented incorrectly; expected at least 4 spaces, found 3
57 | ERROR | [x] Array indentation error, expected 4 spaces but found 3
58 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
58 | ERROR | [x] Line indented incorrectly; expected at least 4 spaces, found 3
58 | ERROR | [x] Array indentation error, expected 4 spaces but found 3
59 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
60 | ERROR | [x] Short array syntax must be used to define arrays
65 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
65 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
66 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
66 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
67 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
67 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
69 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
69 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
70 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
70 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
70 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
70 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
71 | ERROR | [ ] Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
73 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
73 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
74 | ERROR | [ ] Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
76 | ERROR | [x] Short array syntax must be used to define arrays
88 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
88 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 3
88 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 3
89 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
89 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 3
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 47 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/dblog_filter/src/Logger/DBLogFilter.php
---------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
---------------------------------------------------------------------------------------------------------------------
13 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
34 | ERROR | [x] Short array syntax must be used to define arrays
35 | ERROR | [x] Short array syntax must be used to define arrays
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------

Time: 1.03 secs; Memory: 6MB

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

Proposed resolution

Above error/warnings need to be fixed.

🐛 Bug report
Status

Fixed

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.

  • Status changed to RTBC almost 2 years ago
  • Status changed to Fixed almost 2 years ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024