Drupal Coding Standards Issues | phpcs

Created on 24 January 2023, almost 2 years ago
Updated 14 July 2024, 5 months ago

Problem/Motivation

Getting following error/warnings

FILE: C:\xampp\htdocs\abc\drupal\modules\login_by\login_by.info.yml
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
----------------------------------------------------------------------
1 | WARNING | Remove "project" 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: C:\xampp\htdocs\abc\drupal\modules\login_by\login_by.module
----------------------------------------------------------------------
FOUND 4 ERRORS AND 3 WARNINGS AFFECTING 7 LINES
----------------------------------------------------------------------
29 | ERROR | Invalid function name, expected
| | login_by_form_u_se_r_l_og_in_f_or_m_alter but found
| | login_by_form_USER_LOGIN_FORM_alter
53 | WARNING | Translatable strings must not begin or end with
| | white spaces, use placeholders with t() for
| | variables
71 | WARNING | Translatable strings must not begin or end with
| | white spaces, use placeholders with t() for
| | variables
86 | ERROR | Doc comment is empty
107 | ERROR | Doc comment is empty
129 | ERROR | Doc comment is empty
160 | WARNING | Format should be "* Implements hook_foo().", "*
| | Implements hook_foo_BAR_ID_bar() for xyz_bar().",,
| | "* Implements hook_foo_BAR_ID_bar() for
| | xyz-bar.html.twig.", "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "*
| | Implements hook_foo_BAR_ID_bar() for block
| | templates."
----------------------------------------------------------------------

FILE: C:\xampp\htdocs\abc\drupal\modules\login_by\README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
14 | WARNING | Line exceeds 80 characters; contains 96 characters
----------------------------------------------------------------------

FILE: ...ocs\abc\drupal\modules\login_by\src\Form\LoginBySettingsForm.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
----------------------------------------------------------------------
125 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
125 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
----------------------------------------------------------------------

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

Proposed resolution

Above error/warnings need to be fixed.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇮🇳India Charchil Khandelwal

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024