Fix the issues reported by PHPCS

Created on 17 April 2023, over 1 year ago
Updated 6 September 2023, about 1 year ago

Problem/Motivation

FILE: /var/www/html/contribution/drupal10/web/modules/contrib/wordsonline_connector/js/global.js
------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------
2 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/drupal10/web/modules/contrib/wordsonline_connector/js/job_form.js
--------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 4 LINES
--------------------------------------------------------------------------------------------------
28 | ERROR | [x] Inline control structures are not allowed
28 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
32 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
33 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
37 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/drupal10/web/modules/contrib/wordsonline_connector/js/wordsonline-job.js
---------------------------------------------------------------------------------------------------------
FOUND 23 ERRORS AFFECTING 22 LINES
---------------------------------------------------------------------------------------------------------
11 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
15 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
16 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
31 | ERROR | [ ] String concat is not required here; use a single string instead
42 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
47 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
51 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
63 | 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 "NULL" but found "null"
75 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
92 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
117 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
164 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
179 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
246 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
250 | ERROR | [x] Inline control structures are not allowed
257 | ERROR | [x] Inline control structures are not allowed
311 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
323 | ERROR | [x] Inline control structures are not allowed
323 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
327 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
328 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
337 | ERROR | [x] Expected 1 newline at end of file; 0 found
---------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 22 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/drupal10/web/modules/contrib/wordsonline_connector/js/wordsonline.js
-----------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------
1 | ERROR | [x] Additional whitespace found at start of file
-----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/drupal10/web/modules/contrib/wordsonline_connector/src/WordsOnlineTranslatorUi.php
-------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
-------------------------------------------------------------------------------------------------------------------
287 | WARNING | #options values usually have to run through t() for translation
288 | WARNING | #options values usually have to run through t() for translation
289 | WARNING | #options values usually have to run through t() for translation
290 | WARNING | #options values usually have to run through t() for translation
-------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/drupal10/web/modules/contrib/wordsonline_connector/src/Form/UpdateForm.php
-----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------
207 | WARNING | Unused variable $files.
-----------------------------------------------------------------------------------------------------------

Time: 3.16 secs; Memory: 18MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig wordsonline_connector/

Proposed resolution

Execute PHPCBF command and fix all remaining issues after beautifying the code.

Remaining tasks

Patch review.

And one issue remains:
FILE: /var/www/html/contribution/drupal10/web/modules/contrib/wordsonline_connector/src/Form/UpdateForm.php
-----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------
207 | WARNING | Unused variable $files.
-----------------------------------------------------------------------------------------------------------

Time: 3.17 secs; Memory: 18MB

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India urvashi_vora Madhya Pradesh, India

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

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇵🇭Philippines clarkssquared

    Hi urvashi_vora,

    I applied the patch coding-standard-fixes.patch to the "WordsOnline Connector" module against Version 1.0.x-dev. and noticed that there are still phpcs warnings being reported

    Please see the screenshots attached.

    For your review.
    Thank you.

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India Akram Khan Cuttack, Odisha

    address #2 now it remove all phpcs issue

  • Status changed to RTBC over 1 year ago
  • 🇮🇳India saket-001

    patch applied successfully and fixes the all PHPCS error.

  • Status changed to Fixed over 1 year ago
  • + unused variables:
    I have removed they.
    + Some report is not issues:
    1. ERROR | [x] TRUE, FALSE and NULL must be uppercase
    in javascript ,the boolean value accept only true or false values (not TRUE, FALSE) and not value NULL exists instead we use null
    2.options values usually have to run through t() for translation
    These values are on us to be fixed, no need to translate

  • Status changed to Fixed about 1 year ago
Production build 0.71.5 2024