Coding Standard Issues

Created on 29 November 2024, 4 months ago

Problem/Motivation

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css .

FILE: .../web/modules/custom/taxonomy_parents_index/taxonomy_parents_index.module
----------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------
139 | ERROR | [x] Expected 1 blank line after function; 2 found
----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------

FILE: .../web/modules/custom/taxonomy_parents_index/README.md
--------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 9 WARNINGS AFFECTING 9 LINES
--------------------------------------------------------------------------------------
4 | WARNING | Line exceeds 80 characters; contains 297 characters
7 | WARNING | Line exceeds 80 characters; contains 189 characters
10 | WARNING | Line exceeds 80 characters; contains 160 characters
17 | WARNING | Line exceeds 80 characters; contains 109 characters
20 | WARNING | Line exceeds 80 characters; contains 118 characters
23 | WARNING | Line exceeds 80 characters; contains 81 characters
25 | WARNING | Line exceeds 80 characters; contains 104 characters
26 | WARNING | Line exceeds 80 characters; contains 179 characters
31 | WARNING | Line exceeds 80 characters; contains 125 characters
--------------------------------------------------------------------------------------

FILE: .../web/modules/custom/taxonomy_parents_index/src/Form/IndexTaxonomyParents.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\Core\Form\FormBase.
139 | WARNING | [ ] Unused variable $revisionId.
-----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------

FILE: .../web/modules/custom/taxonomy_parents_index/src/Plugin/views/relationship/TaxonomyIndexReverseToParents.php
--------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\views\Plugin\ViewsHandlerManager.
--------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------

FILE: .../web/modules/custom/taxonomy_parents_index/taxonomy_parents_index.install
-----------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
3 | ERROR | [x] Missing function doc comment
-----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------

Steps to reproduce

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css .

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

šŸ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

šŸ‡µšŸ‡ŖPeru alyaj2a

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

Merge Requests

Comments & Activities

  • Issue created by @alyaj2a
  • Merge request !3Coding Standard issues - #3490747 ā†’ (Open) created by alyaj2a
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi alyaj2a,

    I applied your MR !3 and I can still see some PHPCS issues though these issues can be resolved via PHPCBF

    āžœ  taxonomy_parents_index git:(1.0.x) curl https://git.drupalcode.org/project/taxonomy_parents_index/-/merge_requests/3.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  6570    0  6570    0     0  13248      0 --:--:-- --:--:-- --:--:-- 13463
    patching file README.md
    patching file 'src/Form/IndexTaxonomyParents.php'
    patching file 'src/Plugin/views/relationship/TaxonomyIndexReverseToParents.php'
    patching file taxonomy_parents_index.install
    patching file taxonomy_parents_index.module
    āžœ  taxonomy_parents_index git:(1.0.x) āœ— ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml taxonomy_parents_index
    
    FILE: ...modules/contrib/taxonomy_parents_index/src/TaxonomyParentsIndexManager.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     51 | ERROR | [x] Multi-line function declarations must have a trailing comma
        |       |     after the last parameter
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...ents_index/src/Plugin/views/relationship/TaxonomyIndexReverseToParents.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is
       |       |     Drupal\views\Plugin\views\relationship\RelationshipPluginBase.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    Time: 278ms; Memory: 10MB
    
    āžœ  contrib git:(main) āœ— 
  • First commit to issue fork.
  • šŸ‡®šŸ‡³India lavanyatalwar

    Hi @clarkssquared, I have resolved the first error you mentioned, but I am not seeing the second error in my terminal. Could you please let me know the command you used to reproduce this error?

  • Status changed to Needs review about 2 months ago
  • First commit to issue fork.
  • Hey @clarkssquared, I checked for existing coding standard issues and have fixed them.

    @lavanyatalwar, I was able to reproduce the issue using:
    phpcs --standard=Drupal,DrupalPractice --extensions='php,module,inc,install,test,profile,theme,info,yml'.
    It would be helpful to have this set up as an alias on your local machine.

  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi jaswinsingh,

    I tested your commit 107f602c and I can no longer see any PHPCS issues

    āžœ  taxonomy_parents_index git:(1.0.x) curl https://git.drupalcode.org/project/taxonomy_parents_index/-/merge_requests/3.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  6520    0  6520    0     0  12596      0 --:--:-- --:--:-- --:--:-- 12809
    patching file README.md
    patching file 'src/Form/IndexTaxonomyParents.php'
    patching file 'src/TaxonomyParentsIndexManager.php'
    patching file taxonomy_parents_index.install
    patching file taxonomy_parents_index.module
    āžœ  taxonomy_parents_index git:(1.0.x) āœ— ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml taxonomy_parents_index
    āžœ  contrib git:(main) āœ— 

    RTBC +1

Production build 0.71.5 2024