Fix the issue reported by phpcs

Created on 10 July 2024, 5 months ago
Updated 16 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/textimate/

FILE: /var/www/html/drupal-contri-d10/modules/contrib/textimate/js/textimate.settings.js
----------------------------------------------------------------------------------------------
FOUND 38 ERRORS AFFECTING 38 LINES
----------------------------------------------------------------------------------------------
  20 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  57 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  58 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  66 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  67 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  68 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  74 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  75 | 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 "FALSE" but found "false"
  82 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  83 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  84 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  90 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  91 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  92 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  98 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  99 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 100 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 106 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 107 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 108 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 191 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 192 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 205 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 206 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 207 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 213 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 214 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 215 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 221 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 222 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 223 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 229 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 230 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 231 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 237 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 238 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 239 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 38 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------


FILE: /var/www/html/drupal-contri-d10/modules/contrib/textimate/js/textimate.js
----------------------------------------------------------------------------------------------
FOUND 47 ERRORS AFFECTING 26 LINES
----------------------------------------------------------------------------------------------
  15 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  22 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  23 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  24 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  31 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  32 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  33 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  36 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 109 | ERROR | [x] Expected 1 space after "<"; 0 found
 109 | ERROR | [x] Expected 1 space before "="; 0 found
 109 | ERROR | [x] Expected 1 space after "="; 0 found
 109 | ERROR | [x] Expected 1 space before ">"; 0 found
 110 | ERROR | [x] Expected 1 space after "<"; 0 found
 110 | ERROR | [x] Expected 1 space before "="; 0 found
 110 | ERROR | [x] Expected 1 space after "="; 0 found
 110 | ERROR | [x] Expected 1 space before ">"; 0 found
 111 | ERROR | [x] Expected 1 space before "<"; 0 found
 111 | ERROR | [x] Expected 1 space after "<"; 0 found
 111 | ERROR | [x] Expected 1 space before "="; 0 found
 111 | ERROR | [x] Expected 1 space after "="; 0 found
 111 | ERROR | [x] Expected 1 space before ">"; 0 found
 111 | ERROR | [x] Expected 1 space after "<"; 0 found
 111 | ERROR | [x] Expected 1 space before "/"; 0 found
 111 | ERROR | [x] Expected 1 space after "/"; 0 found
 111 | ERROR | [x] Expected 1 space before ">"; 0 found
 111 | ERROR | [x] Expected 1 space after ">"; 0 found
 112 | ERROR | [x] Expected 1 space after "<"; 0 found
 112 | ERROR | [x] Expected 1 space before "/"; 0 found
 112 | ERROR | [x] Expected 1 space after "/"; 0 found
 112 | ERROR | [x] Expected 1 space before ">"; 0 found
 113 | ERROR | [x] Expected 1 space after "<"; 0 found
 113 | ERROR | [x] Expected 1 space before "/"; 0 found
 113 | ERROR | [x] Expected 1 space after "/"; 0 found
 113 | ERROR | [x] Expected 1 space before ">"; 0 found
 138 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
 149 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 154 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 198 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 273 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
 401 | ERROR | [x] Opening brace must be the last content on the line
 410 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 418 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 419 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 427 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 428 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 429 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 436 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 47 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------


FILE: /var/www/html/drupal-contri-d10/modules/contrib/textimate/js/textimate.form.js
----------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------
 148 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 149 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------


FILE: /var/www/html/drupal-contri-d10/modules/contrib/textimate/textimate.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: 508ms; Memory: 18MB

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
    5 months ago
    Total: 166s
    #220504
  • Issue was unassigned.
  • 🇮🇳India bhaveshdas

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

    Thankyou !

  • Pipeline finished with Success
    5 months ago
    Total: 165s
    #220505
  • 🇵🇱Poland mahyarss

    Dear @bhaveshdas,

    I appreciate your detailed report regarding the coding standards for the Textimate 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 textimate.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 files (for example textimate.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 -s --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,json ./textimate
    ........................ 24 / 24 (100%)

    Time: 373ms; Memory: 14MB

    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

  • Assigned to mahyarss
  • Status changed to Fixed 5 months ago
Production build 0.71.5 2024