Fix the issues reported by phpcs

Created on 7 July 2023, about 1 year ago
Updated 23 July 2024, about 2 months ago

Problem/Motivation

FILE: /var/www/html/vb/d_cont/search_api_weaviate/search_api_weaviate.module
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
--------------------------------------------------------------------------------
17 | WARNING | Unused variable $server.
65 | WARNING | #options values usually have to run through t() for translation
66 | WARNING | #options values usually have to run through t() for translation
67 | WARNING | #options values usually have to run through t() for translation
--------------------------------------------------------------------------------

FILE: ...ch_api_weaviate/src/Plugin/search_api/backend/SearchApiWeaviateBackend.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 11 WARNINGS AFFECTING 11 LINES
--------------------------------------------------------------------------------
132 | WARNING | Unused variable $response.
171 | WARNING | Unused variable $index_id.
199 | WARNING | Unused variable $response.
211 | WARNING | Unused variable $response.
235 | WARNING | Unused variable $delta.
271 | WARNING | Unused variable $weaviate_client.
272 | WARNING | Unused variable $index.
278 | WARNING | Unused variable $delta.
310 | WARNING | Unused variable $weaviate_client.
311 | WARNING | Unused variable $response.
363 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
--------------------------------------------------------------------------------

Time: 113ms; Memory: 12MB

Steps to reproduce

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

Remaining tasks

Patch review

šŸ“Œ Task
Status

RTBC

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

Merge Requests

Comments & Activities

  • Issue created by @urvashi_vora
  • šŸ‡®šŸ‡³India Ashutosh Ahirwal India

    Provided patch applied cleanly but still throwing error.
    Providing updated patch with fixes.

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

    Remaining issue
    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/search_api_weaviate/src/Plugin/search_api/backend/SearchApiWeaviateBackend.php
    -------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------------------------------
    9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Serialization\Json.
    -------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------------------------------

    Time: 166ms; Memory: 12MB

  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi @Ashutosh Ahirwal,

    I applied patch #2, it was applied smoothly and fixed the phpcs issues.

    āžœ  search_api_weaviate git:(1.0.x) curl https://www.drupal.org/files/issues/2023-11-01/phpcs-issue-fixes_1.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  6189  100  6189    0     0  15446      0 --:--:-- --:--:-- --:--:-- 15433
    patching file search_api_weaviate.module
    patching file src/Plugin/search_api/backend/SearchApiWeaviateBackend.php
    āžœ  search_api_weaviate git:(1.0.x) āœ— ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml search_api_weaviate
    āžœ  contrib git:(main) āœ—

    RTBC+1 for me.

    Thank you.

  • Status changed to Needs work about 2 months ago
  • šŸ‡µšŸ‡­Philippines clarkssquared

    HI

    I also cloned the module and the dedicated version and applied the patch and confirmed that it fixes PHPCS isses.

    āžœ  search_api_weaviate git:(1.0.x) curl https://www.drupal.org/files/issues/2023-11-01/phpcs-issue-fixes_1.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  6189  100  6189    0     0  13859      0 --:--:-- --:--:-- --:--:-- 14130
    patching file search_api_weaviate.module
    patching file 'src/Plugin/search_api/backend/SearchApiWeaviateBackend.php'
    āžœ  search_api_weaviate git:(1.0.x) āœ— ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml search_api_weaviate 
    āžœ  contrib git:(main) āœ— 
    

    However, for maintainer's convenience can you create a merge request with your patch so that they can easily merge it once it passes the community? moving this ticket to needs work for that.

  • Merge request !1Fixed phpcs issues ā†’ (Open) created by cleavinjosh
  • Status changed to Needs review about 2 months ago
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi,

    Please review MR!1. Thank you.

  • Status changed to RTBC about 2 months ago
  • šŸ‡®šŸ‡³India bhaveshdas

    I have tested MR 1 and it is working properly with no errors found.
    I will move it forward to RTBC.

    RTBC+1

    Thankyou !!

Production build 0.71.5 2024