Fix the issue reported by phpcs

Created on 10 July 2024, 4 months ago

Problem/Motivation

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

FILE: /var/www/html/drupal-contri-d10/modules/contrib/wowjs/wowjs.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: /var/www/html/drupal-contri-d10/modules/contrib/wowjs/wowjs_ui/js/wowjs.init.js
---------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
---------------------------------------------------------------------------------------------
 34 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 35 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 76 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
---------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------


FILE: /var/www/html/drupal-contri-d10/modules/contrib/wowjs/wowjs_ui/wowjs_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
-------------------------------------------------------------------------------------------------------------

Time: 211ms; Memory: 12MB

Steps to reproduce

Run PHPCS on Config Pages module.

Proposed resolution

Fixed the coding standards.

Remaining tasks

Submit the patch either MR.

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India bhaveshdas

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 @bhaveshdas
  • Pipeline finished with Success
    4 months ago
    Total: 158s
    #220487
  • Merge request !13460417-fix-the-issue:fixed phpcs issuse → (Open) created by bhaveshdas
  • Issue was unassigned.
  • Status changed to Needs review 4 months ago
  • 🇮🇳India bhaveshdas

    I have fixed all phpcs Issues could you please review it.

    Thankyou !

  • Pipeline finished with Success
    4 months ago
    Total: 158s
    #220488
  • Assigned to mahyarss
  • Status changed to Fixed 4 months ago
  • 🇵🇱Poland mahyarss

    Dear @bhaveshdas,

    I appreciate your detailed report regarding the coding standards for the wowjs 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 wowjs.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 (wowjs.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

    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
Production build 0.71.5 2024