Phpcs coding standard

Created on 2 April 2020, over 4 years ago
Updated 20 August 2024, 4 months ago
šŸ“Œ Task
Status

Needs work

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India maithri shetty

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 cleavinjosh

    Hi @Maithri Shetty,

    I applied patch #2, it was not applied smoothly but fixed some of the phpcs issues.

    These are the remaining issues after I ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml:

    āžœ  path_file git:(8.x-1.x) curl https://www.drupal.org/files/issues/2020-04-02/3124362-2.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  7704  100  7704    0     0  24885      0 --:--:-- --:--:-- --:--:-- 24851
    patching file src/Controller/PathFileController.php
    patching file src/Entity/PathFileEntity.php
    Hunk #1 succeeded at 61 (offset 1 line).
    Hunk #2 succeeded at 161 (offset 1 line).
    Hunk #3 succeeded at 188 (offset 1 line).
    Hunk #4 succeeded at 204 (offset 1 line).
    patching file src/Entity/PathFileEntityViewsData.php
    patching file src/Form/PathFileEntitySettingsForm.php
    patching file src/PathFileEntityAccessControlHandler.php
    patching file src/PathFileEntityListBuilder.php
    Hunk #1 succeeded at 55 (offset -4 lines).
    Hunk #2 FAILED at 75.
    Hunk #3 FAILED at 89.
    2 out of 3 hunks FAILED -- saving rejects to file src/PathFileEntityListBuilder.php.rej
    āžœ  path_file git:(8.x-1.x) āœ— ..
    āžœ  contrib phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml path_file
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/path_file/path_file.module
    -----------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 2 LINES
    -----------------------------------------------------------------------------------------------
     24 | ERROR | [x] Short array syntax must be used to define arrays
     25 | ERROR | [x] Short array syntax must be used to define arrays
     25 | ERROR | [x] Short array syntax must be used to define arrays
    -----------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/path_file/path_file.install
    ------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    ------------------------------------------------------------------------------------------------
     23 | ERROR | [x] Short array syntax must be used to define arrays
     26 | ERROR | [x] Short array syntax must be used to define arrays
    ------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/path_file/src/Form/PathFileEntitySettingsForm.php
    -----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
    -----------------------------------------------------------------------------------------------------------------------------------------
      7 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
     17 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
     85 | WARNING | [x] '@TODO - is there a cleaner way to rebuild the field definition' should match the format '@todo Fix problem X here.'
    -----------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/path_file/src/Form/PathFileEntityForm.php
    ---------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 8 WARNINGS AFFECTING 7 LINES
    ---------------------------------------------------------------------------------------------------------------------------------------------
      6 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\ContentEntityForm.
     20 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
     62 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
     70 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     73 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     73 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     84 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     87 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     87 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
    ---------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/path_file/src/PathFileEntityAccessControlHandler.php
    ----------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    ----------------------------------------------------------------------------------------------------------------------------
      8 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Access\AccessResult.
     21 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
    ----------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/path_file/src/Entity/PathFileEntity.php
    ------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\ContentEntityBase.
    ------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/path_file/src/Controller/PathFileController.php
    --------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    --------------------------------------------------------------------------------------------------------------------------------------------
      7 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\path_file\Entity\PathFileEntityInterface.
     44 | WARNING | [ ] File::load calls should be avoided in classes, use dependency injection instead
    --------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/path_file/src/PathFileEntityListBuilder.php
    ----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AND 1 WARNING AFFECTING 3 LINES
    ----------------------------------------------------------------------------------------------------------------------------------------
      7 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Datetime\DateFormatterInterface.
     77 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
     78 | ERROR   | [x] Inline comments must start with a capital letter
     78 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
    ----------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 238ms; Memory: 10MB
    
    āžœ  contrib

    Thank you.

Production build 0.71.5 2024