Fix the issues reported by phpcs

Created on 21 March 2024, 9 months ago
Updated 23 March 2024, 9 months ago

Problem/Motivation

FILE: /var/www/html/drupal-contri-d10/modules/custom/google_translator/google_translator.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/custom/google_translator/js/disclaimer.js
-------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
-------------------------------------------------------------------------------------------
52 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
53 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
82 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
89 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
-------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------

Time: 181ms; Memory: 12MB

Steps to reproduce

vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml modules/custom/google_translator/

Remaining tasks

Submit the MR/Patch

šŸ“Œ Task
Status

Closed: works as designed

Version

2.2

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

Comments & Activities

  • Issue created by @bhaveshdas
  • Status changed to Needs review 9 months ago
  • šŸ‡®šŸ‡³India bhaveshdas

    hello

    could you please review it.

    Thankyou !

  • šŸ‡®šŸ‡³India bhaveshdas

    hello,

    fixed all issue.
    But still there are one issues left.
    could you please review it.

    FILE: /var/www/html/drupal-contri-d10/modules/contrib/captchetat/css/captchetat.css
    -----------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------
     1 | ERROR | [x] Expected 1 newline at end of file; 0 found
    -----------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------
    
    Time: 216ms; Memory: 12MB
    
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi

    I applied patch #2 and I confirmed that it fixes all the PHPCS issues.

    āžœ  google_translator git:(master) āœ— curl https://www.drupal.org/files/issues/2024-03-21/3432640-2.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  1300  100  1300    0     0   2119      0 --:--:-- --:--:-- --:--:--  2145
    patching file google_translator.info.yml
    patching file 'js/disclaimer.js'
    āžœ  google_translator git:(master) āœ— ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml google_translator 
    āžœ  contrib git:(master) āœ— 

    RTBC +1 from me.

  • Status changed to Closed: works as designed 9 months ago
  • šŸ‡ŗšŸ‡øUnited States jenna.tollerson Atlanta, Georgia, USA

    Thank you for your report.

    The warnings reported in google_translator.info.yml do not exist in the git source; they are being added to your code by drupal.org packaging. This is working as intended.

    There is no javascript support in the Drupal standards for phpcs. It was removed some time ago. ā†’ Because you specified 'js' as one of the extensions to be evaluated, phpcs is treating it as if it was PHP. However, changing 'true' to 'TRUE' would break the javascript. I suggest pulling the correct list of extensions to evaluate from the coder README: https://github.com/pfrenssen/coder#usage

Production build 0.71.5 2024