Drupal Coding Standards Issues | phpcs

Created on 1 February 2023, almost 2 years ago
Updated 30 July 2024, 5 months ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/entity_reference_views/README.md
------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
------------------------------------------------------------------------
3 | WARNING | [ ] Line exceeds 80 characters; contains 165 characters
6 | WARNING | [ ] Line exceeds 80 characters; contains 99 characters
15 | WARNING | [ ] Line exceeds 80 characters; contains 90 characters
37 | 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/entity_reference_views/src/Plugin/Field/FieldWidget/Select2ViewsWidget.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 2 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
30 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
31 | ERROR | [x] Array closing indentation error, expected 4 spaces but found 6
58 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
62 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
146 | ERROR | [x] Missing function doc comment
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/entity_reference_views/src/Plugin/Field/FieldWidget/AutocompleteViewsWidget.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 2 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
30 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
31 | ERROR | [x] Array closing indentation error, expected 4 spaces but found 6
58 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
62 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
137 | ERROR | [x] Missing function doc comment
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------

Time: 4.84 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/entity_reference_views/

Proposed resolution

Above error/warnings need to be fixed.

๐Ÿ“Œ Task
Status

RTBC

Version

1.1

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

  • Issue created by @samit.310@gmail.com
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia samit.310@gmail.com

    Above error/warnings are fixed.

  • Assigned to Charchil Khandelwal
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Charchil Khandelwal

    I will review this.

  • Issue was unassigned.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Charchil Khandelwal

    Patch #2 applied clearly, warnings and errors are fixed.

  • @charchil-khandelwal opened merge request.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Charchil Khandelwal

    Created MR !6 for this issue,
    please review.

    Thank You.

  • Status changed to RTBC 5 months ago
  • Hi @Charchil Khandelwal,

    The changes you made on MR !6, it applied smoothly and confirmed no issues reportedห‡

    entity_reference_views git:(master) โœ— curl https://git.drupalcode.org/project/entity_reference_views/-/merge_requests/6.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  6182    0  6182    0     0  14246      0 --:--:-- --:--:-- --:--:-- 14614
    patching file README.md
    patching file src/Plugin/Field/FieldWidget/AutocompleteViewsWidget.php
    patching file src/Plugin/Field/FieldWidget/Select2ViewsWidget.php
    โžœ  entity_reference_views git:(master) โœ— cd ..
    โžœ  contrib git:(master) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig entity_reference_views
    
    โžœ  contrib git:(master) โœ—
Production build 0.71.5 2024