Drupal coding standard | phpcs

Created on 7 January 2023, almost 2 years ago
Updated 30 June 2024, 5 months ago

getting issues and warnings in phpcs

$ phpcs --standard=Drupal node_paypal_payment

FILE: ...upal9.4\d9.4\web\modules\node_paypal_payment\src\Controller\NPPPayment.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: ...pal9.4\d9.4\web\modules\node_paypal_payment\src\Controller\NPPRedirect.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: ...\drupal9.4\d9.4\web\modules\node_paypal_payment\src\Form\NPPConfigForm.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found
     |         |     "\r\n"
 187 | WARNING | [x] '@todo - Flesh this out.' should match the format '@todo
     |         |     Fix problem X here.'
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...drupal9.4\d9.4\web\modules\node_paypal_payment\src\Form\NPPPaymentForm.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: ...pp\htdocs\drupal9.4\d9.4\web\modules\node_paypal_payment\src\NPPObject.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
--------------------------------------------------------------------------------

Time: 474ms; Memory: 8MB
šŸ“Œ Task
Status

Needs work

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India Jay Jangid

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi @Jay

    I applied your MR !2 but I can still see these PHPCS issues

    āžœ  node_paypal_payment git:(8.x-1.x) curl https://git.drupalcode.org/project/node_paypal_payment/-/merge_requests/2.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   443    0   443    0     0    796      0 --:--:-- --:--:-- --:--:--   808
    patching file 'src/Form/NPPConfigForm.php'
    āžœ  node_paypal_payment git:(8.x-1.x) āœ— ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml node_paypal_payment 
    
    FILE: ...local/web/modules/contrib/node_paypal_payment/node_paypal_payment.info.yml
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     1 | WARNING | "core_version_requirement" property is missing in the info.yml
       |         | file
    --------------------------------------------------------------------------------
    
    
    FILE: ...l_local/web/modules/contrib/node_paypal_payment/node_paypal_payment.module
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     9 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is Drupal\Component\Utility\Crypt.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ..._local/web/modules/contrib/node_paypal_payment/src/Form/NPPPaymentForm.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
    --------------------------------------------------------------------------------
       6 | ERROR   | [x] Use statements should be sorted alphabetically. The first
         |         |     wrong one is Drupal\Core\Form\FormBase.
      44 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
         |         |     injection instead
     113 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
         |         |     injection instead
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...ocal/web/modules/contrib/node_paypal_payment/src/Controller/NPPPayment.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
    --------------------------------------------------------------------------------
      48 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
      67 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
     109 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
     129 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
    --------------------------------------------------------------------------------
    
    
    FILE: ...cal/web/modules/contrib/node_paypal_payment/src/Controller/NPPRedirect.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
    --------------------------------------------------------------------------------
      6 | ERROR   | [x] Use statements should be sorted alphabetically. The first
        |         |     wrong one is Drupal\Core\Controller\ControllerBase.
     20 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
        |         |     injection instead
     31 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
        |         |     injection instead
     55 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
        |         |     injection instead
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    Time: 252ms; Memory: 10MB
    
    āžœ  contrib git:(main) āœ— 
    
Production build 0.71.5 2024