Drupal Coding Standards Issues | phpcs

Created on 2 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/add_child_page/README.md
-----------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------
65 | WARNING | [ ] Line exceeds 80 characters; contains 93 characters
65 | ERROR | [x] Expected 1 newline at end of file; 0 found
-----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------

Time: 2.62 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/add_child_page/

Proposed resolution

Above error/warning need to be fixed.

šŸ“Œ Task
Status

Needs work

Version

2.0

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/warning are fixed.

  • Assigned to Sonal Gyanani
  • @sonal-gyanani opened merge request.
  • Issue was unassigned.
  • šŸ‡®šŸ‡³India Sonal Gyanani

    Patch #2 applied cleanly, and all errors and warnings are fixed.
    Created MR for the same.

    RTBC +1
    Thanks

  • Status changed to Needs work 5 months ago
  • Hi Sonal Gyanani,

    Applied the patch that was also put in MR, it was applied successfully, however, there are still errors that was not addressed by the patch/MR. Please see below:

    add_child_page git:(master) āœ— curl https://git.drupalcode.org/project/add_child_page/-/merge_requests/3.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   483    0   483    0     0     98      0 --:--:--  0:00:04 --:--:--   132
    patching file README.md
    āžœ  add_child_page git:(master) āœ— cd ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig add_child_page
    
    FILE: ...rupal-orgissue-v9/web/modules/contrib/add_child_page/add_child_page.module
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     9 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is Drupal\Component\Utility\Html.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...ssue-v9/web/modules/contrib/add_child_page/src/Controller/AddChildPage.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is Drupal\Core\Access\AccessResult.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    Time: 220ms; Memory: 10MB

    Kindly check

    Thanks,
    Jake

Production build 0.71.5 2024