Comply with Drupal coding standards (1)

Created on 10 May 2023, over 1 year ago
Updated 11 May 2023, over 1 year ago

Problem/Motivation

  • Refactor drupal/facade code based on phpcs --standard=DrupalPractice
    
    ]$ cd /var/www/html; phpcs --standard=DrupalPractice --ignore=node_modules,bower_components,vendor --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,yaml,twig,json,ts,tsx,feature /var/www/html/web/modules/contrib/facade/           
    
    FILE: /var/www/html/web/modules/contrib/facade/modules/tenants/openstack_provider/src/Form/Config/OpenStackProviderAdminSettingsForm.php
    ----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    ----------------------------------------------------------------------------------------------------------------------------------------
     479 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     518 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     519 | WARNING | Unused variable $subnet.
    ----------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/modules/contrib/facade/modules/tenants/openstack_provider/src/Service/OpenStackProviderService.php
    --------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    --------------------------------------------------------------------------------------------------------------------------
     557 | WARNING | Unused private method generateStackName()
     573 | WARNING | Unused private method generateStackPrefix()
     607 | WARNING | Unused private method generateBearerToken()
    --------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/modules/contrib/facade/modules/tenants/openstack_provider/openstack_provider.routing.yml
    ------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------------------------------
     7 | WARNING | The administration page callback should probably use "administer site configuration" - which implies the user can change something -
       |         | rather than "access administration pages" which is about viewing but not changing configurations.
    ------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/modules/contrib/facade/modules/tenants/openstack_provider/tenant_project.page.inc
    ---------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------
     24 | WARNING | Unused variable $project.
    ---------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/modules/contrib/facade/modules/tenants/openstack_provider/openstack_provider.module
    -----------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------
     141 | WARNING | Unused variable $account.
    -----------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/modules/contrib/facade/facade.routing.yml
    ------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------------------------------
     7 | WARNING | The administration page callback should probably use "administer site configuration" - which implies the user can change something -
       |         | rather than "access administration pages" which is about viewing but not changing configurations.
    ------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/modules/contrib/facade/tenant.page.inc
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
     24 | WARNING | Unused variable $tenant.
    ----------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/modules/contrib/facade/src/Form/Config/FacadeAdminSettings.php
    --------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------------
     116 | WARNING | Unused variable $config.
    --------------------------------------------------------------------------------------
    
πŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @phyllanthus
  • There are still warnings in 4 files, all related to unused variables (or functions).

    However, these appear to be intentional and I think do not need to be removed.

    
    FILE: modules/tenants/openstack_provider/src/Service/OpenStackProviderService.php
    ---------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    ---------------------------------------------------------------------------------
     557 | WARNING | Unused private method generateStackName()
     573 | WARNING | Unused private method generateStackPrefix()
     607 | WARNING | Unused private method generateBearerToken()
    ---------------------------------------------------------------------------------
    
    
    FILE: modules/tenants/openstack_provider/tenant_project.page.inc
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
     24 | WARNING | Unused variable $project.
    ----------------------------------------------------------------------
    
    
    FILE: src/Form/Config/FacadeAdminSettings.php
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
     116 | WARNING | Unused variable $config.
    ----------------------------------------------------------------------
    
    
    FILE: tenant.page.inc
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
     24 | WARNING | Unused variable $tenant.
    ----------------------------------------------------------------------
    
    
  • @nakamurarts opened merge request.
  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • πŸ‡―πŸ‡΅Japan sekinet

    @nakamurarts

    We should fix this warning and change the status to Needs work.

  • @sekinet

    Thank you for your review.
    That has been fixed and there are no warnings now.

  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States yas California πŸ‡ΊπŸ‡Έ

    @nakamurats

    Thank you for the refactoring. I posted my comments.

    @baldwinlouie

    What do you think?

    Thanks

  • πŸ‡ΊπŸ‡ΈUnited States baldwinlouie

    @nakamurarts @yas, Thank you for the patch. It looks good to me aside from @yas' comments.

  • Status changed to Needs review over 1 year ago
  • @yas @baldwinlouie

    Thank you all for the reviews.
    I refactored the field name `cloud` to `cloudService` (and the constructor argument `cloud` to `cloud_service`).

  • Status changed to RTBC over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States yas California πŸ‡ΊπŸ‡Έ

    @nakamurarts

    Thank you for the update. I'll merge the patch to 1.x, and close this issue as Fixed.

  • Status changed to Fixed over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States yas California πŸ‡ΊπŸ‡Έ
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024