Drupal Coding Standards Issues | phpcs

Created on 23 January 2023, almost 2 years ago
Updated 19 July 2024, 5 months ago

Problem/Motivation

Getting Following errors/warnings

$ phpcs --standard=Drupal views_default_user_taxonomy

FILE: ...task\views_default_user_taxonomy\src\Plugin\views\argument_default\Tid.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found
   |       |     "\r\n"
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...fault_user_taxonomy\tests\src\Kernel\Views\TaxonomyDefaultArgumentTest.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AND 4 WARNINGS AFFECTING 7 LINES
--------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found
     |         |     "\r\n"
  40 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: 'user'
 111 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: )
 112 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: ]
 113 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: ]
 121 | ERROR   | [x] Expected 1 blank line after function; 0 found
 122 | ERROR   | [x] The closing brace for the class must have an empty line
     |         |     before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...top\task\views_default_user_taxonomy\views_default_user_taxonomy.views.inc
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found
   |       |     "\r\n"
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 455ms; Memory: 8MB

Proposed resolution

Fix the errors and warnings.

šŸ› Bug report
Status

RTBC

Version

2.0

Component

Code

Created by

šŸ‡®šŸ‡³India jay jangid Jaipur

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

Merge Requests

Comments & Activities

  • Issue created by @jay jangid
  • šŸ‡®šŸ‡³India jay jangid Jaipur

    Created MR , please review.

    Thank you.

  • šŸ‡®šŸ‡³India riddhi.addweb

    After applying the Patch [MR3] the PHPCS error is not resolved, it is still displayed Attaching error and its Screenshot for the same.

    FILE: /var/www/html/web/drupal10/web/modules/contrib/views_default_user_taxonomy/tests/src/Kernel/Views/TaxonomyDefaultArgumentTest.php
    ----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------------------------
    10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Tests\taxonomy\Kernel\Views\TaxonomyTestBase.
    ----------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------------

    FILE: /var/www/html/web/drupal10/web/modules/contrib/views_default_user_taxonomy/src/Plugin/views/argument_default/Tid.php
    --------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------------------
    7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\node\NodeInterface.
    --------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------

    FILE: /var/www/html/web/drupal10/web/modules/contrib/views_default_user_taxonomy/README.md
    ------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------
    51 | WARNING | Line exceeds 80 characters; contains 82 characters
    ------------------------------------------------------------------------------------------

  • Status changed to Needs work 6 months ago
  • First commit to issue fork.
  • Status changed to Needs review 5 months ago
  • šŸ‡µšŸ‡­Philippines paraderojether

    Hi

    I fix the remaining issues, please review.

    Thank you

  • Status changed to RTBC 5 months ago
  • Hi @paraderojether,

    The changes you made on MR!3 can be applied successfully, confirmed all errors are now fixed.

    views_default_user_taxonomy git:(2.0.x) curl https://git.drupalcode.org/project/views_default_user_taxonomy/-/merge_requests/3.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2860    0  2860    0     0   6573      0 --:--:-- --:--:-- --:--:--  6745
    patching file README.md
    patching file src/Plugin/views/argument_default/Tid.php
    patching file tests/src/Kernel/Views/TaxonomyDefaultArgumentTest.php
    āžœ  views_default_user_taxonomy git:(2.0.x) āœ— cd ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig views_default_user_taxonomy
    āžœ  contrib git:(master) āœ—

    Will now move this to RTBC

    Thanks,
    Jake

Production build 0.71.5 2024