Drupal Coding Standards Issues | phpcs

Created on 23 January 2023, about 2 years ago

Problem/Motivation

Getting following error/warnings

FILE: /var/www/html/modules/contrib/domain_access_search_api/domain_access_search_api.module
----------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
----------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
21 | ERROR | [ ] Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
25 | WARNING | [ ] Line exceeds 80 characters; contains 84 characters
----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------

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

FILE: /var/www/html/modules/contrib/domain_access_search_api/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------
3 | WARNING | Line exceeds 80 characters; contains 90 characters
4 | WARNING | Line exceeds 80 characters; contains 90 characters
9 | WARNING | Line exceeds 80 characters; contains 92 characters
10 | WARNING | Line exceeds 80 characters; contains 91 characters
----------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/domain_access_search_api/src/Plugin/views/filter/DomainAccessSearchApiCurrentAllFilter.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
5 | WARNING | [x] Unused use statement
24 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
47 | ERROR | [x] Data types in @var tags need to be fully namespaced
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------

Time: 2.05 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/domain_access_search_api/

Proposed resolution

Above error/warnings need to be fixed.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India samit.310@gmail.com

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

Production build 0.71.5 2024