Fix the issues reported by phpcs

Created on 24 May 2023, about 1 year ago
Updated 8 June 2023, about 1 year ago

Problem/Motivation

nishant@drupal10-test-web:/var/www/html$ vendor/bin/phpcs --standard=DrupalPractice,Drupal --extensions=php,module,info,txt,md,yml web/modules/contrib/fontawesome/

FILE: .../html/web/modules/contrib/fontawesome/modules/fontawesome_iconpicker_widget/src/Plugin/Field/FieldWidget/FontAwesomeIconpickerWidget.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------------
128 | ERROR | unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.
----------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/fontawesome/modules/fontawesome_iconpicker_widget/src/IconManagerService.php
--------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AND 3 WARNINGS AFFECTING 7 LINES
--------------------------------------------------------------------------------------------------------------------
110 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 10
111 | ERROR | [x] Line indented incorrectly; expected 14 spaces, found 12
112 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 10
113 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 10
162 | WARNING | [ ] Unused variable $item.
202 | ERROR | [x] list(...) is forbidden, use [...] instead.
202 | WARNING | [ ] Unused variable $prefix.
216 | ERROR | [x] list(...) is forbidden, use [...] instead.
216 | WARNING | [ ] Unused variable $base.
--------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/fontawesome/modules/fontawesome_iconpicker_widget/src/Commands/FontawesomeIconPickerCommands.php
----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------
60 | WARNING | [x] 'TODO: any way to get path for libraries directory?' should match the format '@todo Fix problem X here.'
----------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/fontawesome/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
50 | WARNING | Line exceeds 80 characters; contains 83 characters
52 | WARNING | Line exceeds 80 characters; contains 90 characters
----------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/fontawesome/fontawesome.module
---------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
---------------------------------------------------------------------------------------------------------------------------------------
144 | WARNING | [x] 'TODO: add integrity and crossorigin to CSS.' should match the format '@todo Fix problem X here.'
163 | ERROR | [x] Use null coalesce operator instead of ternary operator.
397 | WARNING | [x] 'TODO: need to add the correct class depending on icon type.' should match the format '@todo Fix problem X here.'
409 | WARNING | [x] 'TODO: this is waiting on an 8.x release of Icon API.' should match the format '@todo Fix problem X here.'
---------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/fontawesome/src/Plugin/Field/FieldFormatter/FontAwesomeIconFormatter.php
--------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------------
129 | ERROR | unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.
--------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/fontawesome/src/Plugin/Field/FieldWidget/FontAwesomeIconWidget.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 26 ERRORS AFFECTING 26 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
109 | ERROR | [ ] unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes
| | option.
165 | ERROR | [x] Use null coalesce operator instead of ternary operator.
187 | ERROR | [x] Use null coalesce operator instead of ternary operator.
194 | ERROR | [x] Use null coalesce operator instead of ternary operator.
202 | ERROR | [x] Use null coalesce operator instead of ternary operator.
210 | ERROR | [x] Use null coalesce operator instead of ternary operator.
229 | ERROR | [x] Use null coalesce operator instead of ternary operator.
242 | ERROR | [x] Use null coalesce operator instead of ternary operator.
249 | ERROR | [x] Use null coalesce operator instead of ternary operator.
269 | ERROR | [x] Use null coalesce operator instead of ternary operator.
287 | ERROR | [x] Use null coalesce operator instead of ternary operator.
294 | ERROR | [x] Use null coalesce operator instead of ternary operator.
301 | ERROR | [x] Use null coalesce operator instead of ternary operator.
318 | ERROR | [x] Use null coalesce operator instead of ternary operator.
330 | ERROR | [x] Use null coalesce operator instead of ternary operator.
360 | ERROR | [x] Use null coalesce operator instead of ternary operator.
384 | ERROR | [x] Use null coalesce operator instead of ternary operator.
409 | ERROR | [x] Use null coalesce operator instead of ternary operator.
416 | ERROR | [x] Use null coalesce operator instead of ternary operator.
423 | ERROR | [x] Use null coalesce operator instead of ternary operator.
445 | ERROR | [x] Use null coalesce operator instead of ternary operator.
452 | ERROR | [x] Use null coalesce operator instead of ternary operator.
477 | ERROR | [x] Use null coalesce operator instead of ternary operator.
484 | ERROR | [x] Use null coalesce operator instead of ternary operator.
508 | ERROR | [x] Use null coalesce operator instead of ternary operator.
515 | ERROR | [x] Use null coalesce operator instead of ternary operator.
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 25 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/fontawesome/src/Commands/FontawesomeCommands.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------
60 | WARNING | [x] 'TODO: any way to get path for libraries directory?' should match the format '@todo Fix problem X here.'
-----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/fontawesome/src/FontAwesomeManager.php
---------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
---------------------------------------------------------------------------------------------------------------------------------------
53 | ERROR | Parameter $module_extension_list is not described in comment
143 | ERROR | The array declaration extends to column 125 (the limit is 80). The array content should be split up over multiple lines
165 | ERROR | The array declaration extends to column 122 (the limit is 80). The array content should be split up over multiple lines
212 | ERROR | The array declaration extends to column 109 (the limit is 80). The array content should be split up over multiple lines
---------------------------------------------------------------------------------------------------------------------------------------

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

FILE: /var/www/html/web/modules/contrib/fontawesome/fontawesome.routing.yml
------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------
21 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
------------------------------------------------------------------------------------------------------------------

Time: 2.69 secs; Memory: 60.02MB

Steps to reproduce

vendor/bin/phpcs --standard=DrupalPractice,Drupal --extensions=php,module,info,txt,yml web/modules/contrib/fontawesome/

Proposed resolution

Run this command it will fix some automatic issue after that fix manually.
vendor/bin/phpcs --standard=DrupalPractice,Drupal --extensions=php,module,info,txt,yml web/modules/contrib/fontawesome/

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇮🇳India Nishant

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