Drupal Coding Standards | phpcs

Created on 1 March 2023, over 1 year ago
Updated 12 April 2023, over 1 year ago

Problem/Motivation

Getting below phpcs issues:

FILE: auto_node_translate.links.menu.yml
------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------
6 | ERROR | [x] Expected 1 newline at end of file; 2 found
------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------

FILE: auto_node_translate.services.yml
----------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------
12 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------

FILE: src/Form/TranslationForm.php
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 8 WARNINGS AFFECTING 8 LINES
----------------------------------------------------------------------------------------------
26 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
59 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
69 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
94 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
97 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
98 | WARNING | Unused variable $module_path.
121 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
122 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------

FILE: src/Form/ConfigForm.php
-------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
-------------------------------------------------------------------------------------------------
40 | WARNING | #options values usually have to run through t() for translation
41 | WARNING | #options values usually have to run through t() for translation
42 | WARNING | #options values usually have to run through t() for translation
43 | WARNING | #options values usually have to run through t() for translation
44 | WARNING | #options values usually have to run through t() for translation
268 | WARNING | File::load calls should be avoided in classes, use dependency injection instead
-------------------------------------------------------------------------------------------------

FILE: src/AmazonTranslateApi.php
----------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------
30 | WARNING | Unused variable $referer.
----------------------------------------------------------------------------------

Steps to reproduce

Run phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,css,info,yml .

Proposed resolution

Fix the issues reported and run phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,css,info,yml . to check there are no more issues reported.

🐛 Bug report
Status

Fixed

Version

2.1

Component

Code

Created by

🇮🇳India hardikpandya

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

Comments & Activities

Production build 0.71.5 2024