Hey, I came across some best practices issues and coding standards, example of Drupal practices :

phpcs --standard=Drupal modules/contrib/faqfield/

FILE: /var/www/drupal-8/modules/contrib/faqfield/src/Plugin/Field/FieldWidget/FaqFieldDefaultWidget.php
-------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------
 213 | ERROR   | [x] Space found before comma in function call
 215 | WARNING | [ ] Do not concatenate strings to translatable strings, they should be part of the t() argument and you should use placeholders
 216 | WARNING | [ ] Do not concatenate strings to translatable strings, they should be part of the t() argument and you should use placeholders
-------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/drupal-8/modules/contrib/faqfield/faqfield.module
---------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 6 LINES
---------------------------------------------------------------------------------
  12 | ERROR | [x] When importing a class with "use", do not include a leading \
  88 | ERROR | [ ] Type hint "array" missing for $variables
 104 | ERROR | [ ] Type hint "array" missing for $variables
 119 | ERROR | [ ] Type hint "array" missing for $variables
 139 | ERROR | [ ] Type hint "array" missing for $variables
 160 | ERROR | [ ] Type hint "array" missing for $variables
---------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------

Time: 341ms; Memory: 10MB
CommentFileSizeAuthor
#2 coding_standards-3065900-2.patch4.13 KBsergiu stici

Comments

Sergiu Stici created an issue. See original summary.

sergiu stici’s picture

Status: Active » Needs review
StatusFileSize
new4.13 KB

Here is the patch, please review.

vuil’s picture

Status: Needs review » Reviewed & tested by the community

#2 is OK. Thank you.

vuil’s picture

Status: Reviewed & tested by the community » Patch (to be ported)
pifagor’s picture

Status: Patch (to be ported) » Reviewed & tested by the community

  • pifagor committed 343caa7 on 8.x-1.x authored by Sergiu Stici
    Issue #3065900 by Sergiu Stici, pifagor: Drupal best practices and...
pifagor’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.