Fix the issues reported by phpcs

Created on 11 July 2023, over 1 year ago
Updated 16 November 2023, about 1 year ago

Problem/Motivation

FILE: /var/www/html/vb/d_cont/migrate_youtube/migrations_examples/README.txt
----------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
----------------------------------------------------------------------------
1 | WARNING | Line exceeds 80 characters; contains 81 characters
2 | WARNING | Line exceeds 80 characters; contains 105 characters
4 | WARNING | Line exceeds 80 characters; contains 99 characters
----------------------------------------------------------------------------

FILE: ...ont/migrate_youtube/src/Plugin/migrate_plus/data_parser/YoutubeApiJson.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
28 | ERROR | [x] Expected "arraymixed" but found "array" for @var tag
| | in member variable comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 164ms; Memory: 10MB

Steps to reproduce

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

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

Comments & Activities

  • Issue created by @urvashi_vora
  • Status changed to Needs work about 1 year ago
  • šŸ‡®šŸ‡³India ashutosh ahirwal India

    Provided patch get applied cleanly but still throwing some error.

    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/migrate_youtube

    Remaining issue
    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/migrate_youtube/src/Plugin/migrate_plus/data_parser/YoutubeApiJson.php
    -----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------------------------
    81 | ERROR | Function utf8_encode() has been deprecated
    -----------------------------------------------------------------------------------------------------------------------------------------------

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/migrate_youtube/src/Plugin/migrate/source/YoutubeApiPlaylistItemsUrl.php
    -------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------------------------
    6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\migrate\MigrateException.
    -------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------------------------

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/migrate_youtube/src/Plugin/migrate/source/YoutubeApiPlaylistUrl.php
    --------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------------------------------------
    6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\migrate\MigrateException.
    --------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------------------------

    Time: 152ms; Memory: 10MB

  • Status changed to Needs review about 1 year ago
  • šŸ‡·šŸ‡ŗRussia zniki.ru

    Thanks Ashutosh Ahirwal for the feedback.
    I was not able to reproduce error message for Function utf8_encode() has been deprecated
    using the same command. But I replace utf8_encode() with mb_convert_encoding().
    New patch and interdiff attached.

  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi

    I applied the patch #3 and I confirmed that it fixes all the PHPCS issue hence there are no PHPCS issues being flagged.

    āžœ  migrate_youtube git:(1.0.x) curl https://www.drupal.org/files/issues/2023-11-13/3373755-migrate_youtube-cs_fix_3.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2893  100  2893    0     0   6097      0 --:--:-- --:--:-- --:--:--  6181
    patching file 'migrations_examples/README.txt'
    patching file 'src/Plugin/migrate/source/YoutubeApiPlaylistItemsUrl.php'
    patching file 'src/Plugin/migrate/source/YoutubeApiPlaylistUrl.php'
    patching file 'src/Plugin/migrate_plus/data_parser/YoutubeApiJson.php'
    āžœ  migrate_youtube git:(1.0.x) āœ— ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml migrate_youtube 
    āžœ  contrib git:(master) āœ— 
    

    retaining the status to needs review so that others can give their feedback to patch #3, RTBC +1 for me

  • šŸ‡·šŸ‡ŗRussia zniki.ru

    Thanks for review, I fix one more thing, please make a review again.

  • First commit to issue fork.
  • Status changed to RTBC about 1 year ago
  • Hello @zniki,

    I have tested the patch for migrating YouTube against version 1.x. It successfully resolves the phpcs errors and warnings reported by PHP CodeSniffer. Moving to RTBC++.

    Thank you.

Production build 0.71.5 2024