Drupal Coding Standard As Per phpcs --standard=Drupal

Created on 17 August 2023, over 1 year ago
Updated 18 August 2024, 3 months ago

Problem/Motivation

$ phpcs --standard=Drupalpractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml nextjs_revalidate

FILE: C:\Users\abc\Downloads\nextjs_revalidate\nextjs_revalidate.module
------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------
32 | WARNING | There must be no blank line following an inline comment
40 | WARNING | There must be no blank line following an inline comment
------------------------------------------------------------------------

Time: 163ms; Memory: 6MB

šŸ“Œ Task
Status

Needs work

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India Priya_Degwekar

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

Comments & Activities

  • Issue created by @Priya_Degwekar
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India Priya_Degwekar

    I've created a patch.
    Please review.

  • Status changed to Needs work 3 months ago
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi Priya

    I applied your patch #3 but i can still see many PHPCS issues inside the module.

    āžœ  nextjs_revalidate git:(main) āœ— curl https://www.drupal.org/files/issues/2023-08-17/3381575.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   937  100   937    0     0   2074      0 --:--:-- --:--:-- --:--:--  2110
    patching file nextjs_revalidate.module
    āžœ  nextjs_revalidate git:(main) āœ— ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml nextjs_revalidate 
    
    FILE: ...rupal_local/web/modules/contrib/nextjs_revalidate/nextjs_revalidate.module
    --------------------------------------------------------------------------------
    FOUND 20 ERRORS AFFECTING 14 LINES
    --------------------------------------------------------------------------------
      1 | ERROR | [x] Missing file doc comment
      6 | ERROR | [x] The first parameter of a multi-line function declaration must
        |       |     be on the line after the opening bracket
      6 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced
        |       |     with use statements
      6 | ERROR | [x] Multi-line function declarations must have a trailing comma
        |       |     after the last parameter
     14 | ERROR | [x] The first parameter of a multi-line function declaration must
        |       |     be on the line after the opening bracket
     14 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced
        |       |     with use statements
     14 | ERROR | [x] Multi-line function declarations must have a trailing comma
        |       |     after the last parameter
     22 | ERROR | [ ] Missing parameter comment
     22 | ERROR | [ ] Missing parameter type
     24 | ERROR | [ ] Description for the @return value is missing
     26 | ERROR | [ ] All functions defined in a module file must be prefixed with
        |       |     the module's name, found "hook_nextjs_revalidate_entity" but
        |       |     expected "nextjs_revalidate_hook_nextjs_revalidate_entity"
     27 | ERROR | [x] No space found before comment text; expected "// if (" but
        |       |     found "//if ("
     27 | ERROR | [x] Inline comments must start with a capital letter
     30 | ERROR | [x] No space found before comment text; expected "// ) {" but
        |       |     found "//) {"
     32 | ERROR | [x] No space found before comment text; expected "// }" but found
        |       |     "//}"
     33 | ERROR | [x] No space found before comment text; expected "//
        |       |     \Drupal::messenger()->addStatus(" but found
        |       |     "//\Drupal::messenger()->addStatus("
     35 | ERROR | [ ] Comment indentation error, expected only 2 spaces
     39 | ERROR | [x] No space found before comment text; expected "// );" but
        |       |     found "//);"
     40 | ERROR | [x] No space found before comment text; expected "// $queue =
        |       |     \Drupal::service('queue')->get('nextjs_revalidate_queue');"
        |       |     but found "//$queue =
        |       |     \Drupal::service('queue')->get('nextjs_revalidate_queue');"
     41 | ERROR | [x] No space found before comment text; expected "//
        |       |     $queue->createItem($entity);" but found
        |       |     "//$queue->createItem($entity);"
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 15 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: .../Projects/d10/drupal_local/web/modules/contrib/nextjs_revalidate/README.md
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
     4 | WARNING | Line exceeds 80 characters; contains 165 characters
     9 | WARNING | Line exceeds 80 characters; contains 110 characters
    --------------------------------------------------------------------------------
    
    
    FILE: ...pal_local/web/modules/contrib/nextjs_revalidate/nextjs_revalidate.info.yml
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     1 | WARNING | Remove "project" from the info file, it will be added by
       |         | drupal.org packaging automatically
     1 | WARNING | Remove "datestamp" from the info file, it will be added by
       |         | drupal.org packaging automatically
     1 | WARNING | Remove "version" from the info file, it will be added by
       |         | drupal.org packaging automatically
    --------------------------------------------------------------------------------
    
    
    FILE: ...l_local/web/modules/contrib/nextjs_revalidate/src/Constants/Revalidate.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     5 | ERROR | [x] Missing class doc comment
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...contrib/nextjs_revalidate/src/Plugin/QueueWorker/NextjsRevalidateQueue.php
    --------------------------------------------------------------------------------
    FOUND 8 ERRORS AND 1 WARNING AFFECTING 8 LINES
    --------------------------------------------------------------------------------
      56 | ERROR   | [x] Multi-line function declarations must have a trailing
         |         |     comma after the last parameter
      90 | ERROR   | [ ] Missing parameter comment
      92 | ERROR   | [ ] Description for the @return value is missing
      93 | ERROR   | [x] Separate the @return and @throws sections by a blank line.
      98 | WARNING | [x] '@TODO find a way to be able to alter these supported
         |         |     types.' should match the format '@todo Fix problem X
         |         |     here.'
      98 | ERROR   | [x] No space found before comment text; expected "// @TODO
         |         |     find a way to be able to alter these supported types." but
         |         |     found "//@TODO find a way to be able to alter these
         |         |     supported types."
     102 | ERROR   | [x] Case breaking statements must be followed by a single
         |         |     blank line
     109 | ERROR   | [x] Case breaking statements must be followed by a single
         |         |     blank line
     112 | ERROR   | [x] Case breaking statements must be followed by a single
         |         |     blank line
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...cal/web/modules/contrib/nextjs_revalidate/src/Service/RevalidateHelper.php
    --------------------------------------------------------------------------------
    FOUND 4 ERRORS AFFECTING 4 LINES
    --------------------------------------------------------------------------------
      7 | ERROR | [x] Missing class doc comment
     12 | ERROR | [ ] Missing parameter comment
     21 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced
        |       |     with use statements
     40 | ERROR | [x] Expected newline after closing brace
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    Time: 117ms; Memory: 10MB
    
    āžœ  contrib git:(main) āœ— 
    
Production build 0.71.5 2024