Fix the issues reported by phpcs

Created on 10 July 2024, 4 months ago

Problem/Motivation

Running :-
vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig web/modules/contrib/fontawesome_ui/

returns the following warnings/errors, which should be fixed.

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/fontawesome_ui/css/layout/form.css
-----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------
1 | WARNING | File appears to be minified and cannot be processed
-----------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/fontawesome_ui/fontawesome_ui.info.yml
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
-------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/fontawesome_ui/fontawesome_ui.module
------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------
24 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/fontawesome_ui/src/FontAwesomeAdmin.php
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Datetime\DateFormatterInterface.
-------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/fontawesome_ui/src/Commands/FontAwesomeCommands.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Archiver\ArchiverManager.
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/fontawesome_ui/src/Form/FontAwesomeDuplicate.php
---------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Datetime\TimeInterface.
---------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/fontawesome_ui/src/Form/FontAwesomeSettings.php
-----------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------
9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Ajax\AjaxResponse.
-----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/fontawesome_ui/src/Form/FontAwesomeIconFormSettings.php
------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Utility\Color.
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/fontawesome_ui/src/Form/FontAwesomeDelete.php
--------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\ConfirmFormBase.
--------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------

Time: 4.58 secs; Memory: 102.66MB

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan

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

Merge Requests

Comments & Activities

  • Issue created by @prem suthar
  • Assigned to sourav_paul
  • Assigned to mahyarss
  • 🇵🇱Poland mahyarss

    Dear @prem-suthar,

    I appreciate your detailed report regarding the coding standards for the fontawesome_ui module. However, it appears that there are some inaccuracies in the report generated by PHPCS.

    For reviewing coding standard issues for the module, it is essential to utilize the source code branch. The warnings to remove "project", "datestamp", and "version" from the fontawesome_ui.info.yml file are misleading, as these elements are not present in the source code and are automatically appended during the Drupal.org packaging process.

    Additionally, the errors reported in the JavaScript file (fontawesome_ui.init.js) regarding the usage of true, false, and null are incorrect. In JavaScript, these values must be written in lowercase ("true", "false", "null"). Changing them to uppercase will result in execution errors. The suggested changes to capitalize these constants are incorrect and will cause functional issues.

    Please refer to @apaderno response on Drupal.org regarding this issue:

    JavaScript uses true, false, and null, written exactly like that. PHP_CodeSniffer applies PHP rules to JavaScript files, which is wrong. To verify which rules PHP_CodeSniffer uses, it is sufficient to run phpcs --standard=Drupal,DrupalPractice -s --extensions=js to notice that.

    Generic.PHP.UpperCaseConstant.Found is a rule for PHP, not for JavaScript.

    https://www.drupal.org/project/date_range_picker/issues/3370203#comment-15143723 📌 Fix the issue reported by phpcs Closed: won't fix

    These results are reported from the source code of the branch:

    $ phpcs -p --colors --no-cache --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,json ./fontawesome_ui/
    ..............S.......................................... 57 / 57 (100%)

    FILE: \fontawesome_ui\css\layout\form.css
    ---------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------
    1 | WARNING | File appears to be minified and cannot be processed
    ---------------------------------------------------------------------------------------------

    Time: 2.46 secs; Memory: 110MB

    As you can see, no problem is found in this report.

    I recommend reviewing the branch source code for accurate results and disregarding the incorrect JavaScript errors.

    Thank you for your attention to these details.

    Best regards,
    Mahyar SBT

  • Status changed to Fixed 4 months ago
  • Pipeline finished with Success
    4 months ago
    Total: 160s
    #220617
  • Pipeline finished with Success
    4 months ago
    Total: 165s
    #220622
  • Issue was unassigned.
  • 🇮🇳India sourav_paul Kolkata

    @mahyarsbt I've noticed that this error reported by PHP code sniffer at 1.0.x branch, Hence Raised the MR...

    FILE: /home/sourav/projects/my_site/web/modules/contrib/fontawesome_ui/css/layout/form.css
    ------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------
     1 | WARNING | File appears to be minified and cannot be processed
    ------------------------------------------------------------------------------------------
    
    
    FILE: /home/sourav/projects/my_site/web/modules/contrib/fontawesome_ui/fontawesome_ui.module
    ------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------
     24 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
    ------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/sourav/projects/my_site/web/modules/contrib/fontawesome_ui/src/Commands/FontAwesomeCommands.php
    ------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Archiver\ArchiverManager.
    ------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/sourav/projects/my_site/web/modules/contrib/fontawesome_ui/src/FontAwesomeAdmin.php
    -------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Datetime\DateFormatterInterface.
    -------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/sourav/projects/my_site/web/modules/contrib/fontawesome_ui/src/Form/FontAwesomeDuplicate.php
    ---------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Datetime\TimeInterface.
    ---------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/sourav/projects/my_site/web/modules/contrib/fontawesome_ui/src/Form/FontAwesomeDelete.php
    --------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\ConfirmFormBase.
    --------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/sourav/projects/my_site/web/modules/contrib/fontawesome_ui/src/Form/FontAwesomeIconFormSettings.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Utility\Color.
    ------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/sourav/projects/my_site/web/modules/contrib/fontawesome_ui/src/Form/FontAwesomeSettings.php
    -----------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------
     9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Ajax\AjaxResponse.
    -----------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------
    
    Time: 2.5 secs; Memory: 114.66MB
    
Production build 0.71.5 2024