Fix the issues reported by phpcs

Created on 20 February 2023, over 1 year ago
Updated 4 July 2023, 12 months ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/flat_taxonomy/flat_taxonomy.module
---------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 11 ERRORS AND 5 WARNINGS AFFECTING 12 LINES
---------------------------------------------------------------------------------------------------------------------------------------------------
9 | WARNING | [x] Unused use statement
16 | WARNING | [ ] Global constants should not be used, move it to a class or interface
21 | WARNING | [ ] Global constants should not be used, move it to a class or interface
29 | ERROR | [x] Short array syntax must be used to define arrays
38 | WARNING | [x] '@TODO: Add a confirm step if the vocabulary is updated to be flatten and' should match the format '@todo Fix problem X here.'
45 | ERROR | [ ] Missing parameter comment
45 | ERROR | [ ] Missing parameter type
46 | ERROR | [ ] Missing parameter comment
47 | ERROR | [ ] Missing parameter comment
47 | ERROR | [ ] Missing parameter type
48 | ERROR | [ ] Missing parameter comment
74 | ERROR | [x] Short array syntax must be used to define arrays
74 | ERROR | [ ] The array declaration extends to column 222 (the limit is 80). The array content should be split up over multiple lines
75 | ERROR | [x] Short array syntax must be used to define arrays
75 | ERROR | [ ] The array declaration extends to column 215 (the limit is 80). The array content should be split up over multiple lines
77 | WARNING | [x] '@TODO: Update the term weight so it is ordered after the parent.' should match the format '@todo Fix problem X here.'
---------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/flat_taxonomy/flat_taxonomy.schema.yml
--------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------
7 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/flat_taxonomy/src/Flattener.php
-----------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AFFECTING 8 LINES
-----------------------------------------------------------------------------------------------------
3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
28 | ERROR | [ ] Missing short description in doc comment
33 | ERROR | [ ] Missing short description in doc comment
34 | ERROR | [ ] Missing parameter comment
44 | ERROR | [ ] Missing parameter comment
58 | ERROR | [ ] Missing parameter comment
59 | ERROR | [ ] Missing parameter comment
59 | ERROR | [ ] Missing parameter type
61 | ERROR | [x] Visibility must be declared on method "flatten_subtree"
61 | ERROR | [ ] Method name "Flattener::flatten_subtree" is not in lowerCamel format
-----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------

Time: 1.75 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/flat_taxonomy/

Proposed resolution

Above error/warnings need to be fixed.

📌 Task
Status

Fixed

Version

1.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

Production build 0.69.0 2024