phpcs --standard=DrupalPractice unused variable

Created on 28 June 2022, over 2 years ago
Updated 20 August 2024, 4 months ago

FILE: C:\xampp_new\htdocs\contribute\web\modules\custom\omdb_api\src\Entity\Controller\OmdbApiEntityController.php
------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------
307 | WARNING | Unused variable $css.
------------------------------------------------------------------------------------------------------------------

šŸ“Œ Task
Status

Needs work

Component

Code

Created by

šŸ‡®šŸ‡³India Harsh panchal

Live updates comments and jobs are added and updated live.
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.

  • hello, @urvashi_vora I have review your merge request.

    These are the steps I followed:

    1. Took clone from git version 1.x in drupal 10.1.x

    2. Ran this command:

    ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig modules/contrib/omdb_api/

    Found errors.

    3. I ran phpcbf and it fixed the issue.

    ./vendor/bin/phpcbf --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig modules/contrib/omdb_api/

    4. Again ran the phpcs command and found no errors.

    Please Review.

  • Status changed to Needs work 4 months ago
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi @Satish_kumar,

    I applied patch#14, it was not applied smoothly but fixed most of the phpcs issues.

    These are the remaining issues after I ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml:

    āžœ  omdb_api git:(1.x-dev) curl https://www.drupal.org/files/issues/2023-08-11/issues-reported-by-phpcs-3293022-14.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 10944  100 10944    0     0  29195      0 --:--:-- --:--:-- --:--:-- 29262
    patching file omdb_api.install
    patching file omdb_api.module
    Hunk #1 FAILED at 6.
    1 out of 1 hunk FAILED -- saving rejects to file omdb_api.module.rej
    patching file src/Entity/Controller/OmdbApiEntityController.php
    patching file src/Entity/Form/OmdbApiEntityForm.php
    patching file src/Entity/Logger/OmdbApiEntityLogger.php
    patching file src/Entity/OmdbApiEntity.php
    Hunk #1 FAILED at 4.
    1 out of 1 hunk FAILED -- saving rejects to file src/Entity/OmdbApiEntity.php.rej
    patching file src/Entity/OmdbApiEntityInterface.php
    patching file src/Entity/Routing/OmdbApiEntityHtmlRouteProvider.php
    patching file src/Entity/Storage/OmdbApiEntityStorage.php
    patching file src/Entity/Storage/OmdbApiEntityStorageInterface.php
    patching file src/Plugin/Derivative/OmdbApiContextualLinks.php
    patching file src/Plugin/Derivative/OmdbApiEntityBundlesMenuLinksDerivative.php
    patching file src/Plugin/DevelGenerate/OmdbApiEntityDevelGenerate.php
    patching file src/Plugin/Validation/Constraint/OmdbApiImdbIdConstraintValidator.php
    patching file tests/src/Kernel/DirectoryTest.php
    āžœ  omdb_api git:(1.x-dev) āœ— ..
    āžœ  contrib phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml omdb_api
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/omdb_api/omdb_api.module
    -------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------
     10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\omdb_api\Entity\Bundle\Series.
    -------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/omdb_api/README.md
    ---------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------
     101 | WARNING | Line exceeds 80 characters; contains 354 characters
    ---------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/omdb_api/omdb_api.install
    ----------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------
     67 | WARNING | There must be no blank line following an inline comment
    ----------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/omdb_api/src/Entity/OmdbApiEntity.php
    --------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    --------------------------------------------------------------------------------------------------------------------------------------------
      13 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\StringTranslation\TranslatableMarkup.
     147 | ERROR | [ ] Comment indentation error, expected only 1 spaces
     150 | ERROR | [ ] Comment indentation error, expected only 1 spaces
    --------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/omdb_api/src/Entity/Controller/OmdbApiEntityController.php
    -------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------
     307 | WARNING | Unused variable $css.
    -------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/omdb_api/src/Entity/OmdbApiEntityUninstallValidator.php
    ---------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\ContentEntityTypeInterface.
    ---------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/omdb_api/src/Commands/OmdbApiEntityDevelGenerateCommands.php
    ---------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------
     40 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
    ---------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------
    
    Time: 1.28 secs; Memory: 18MB
    
    āžœ  contrib

    Thank you.

Production build 0.71.5 2024