Fix the issue reported by phpcs

Created on 16 July 2024, 3 months ago

Problem/Motivation

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

FILE: /var/www/html/drupal-contri-d10/modules/contrib/nginx/src/Form/Settings.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
 12 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Ajax\AjaxResponse.
 25 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 38 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 79 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/drupal-contri-d10/modules/contrib/nginx/src/Service/NginxSite.php
---------------------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AND 6 WARNINGS AFFECTING 9 LINES
---------------------------------------------------------------------------------------------------------------------------------------
   6 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
  10 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
  35 | ERROR   | [x] The first parameter of a multi-line function declaration must be on the line after the opening bracket
  36 | ERROR   | [x] Multi-line function declaration not indented correctly; expected 4 spaces but found 6
  36 | ERROR   | [x] Multi-line function declarations must have a trailing comma after the last parameter
  36 | ERROR   | [x] The closing parenthesis of a multi-line function declaration must be on a new line
  50 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 101 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 112 | WARNING | [ ] Unused variable $key.
 119 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 142 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/drupal-contri-d10/modules/contrib/nginx/src/Service/NginxConf.php
-----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------
  9 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
 43 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-----------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/drupal-contri-d10/modules/contrib/nginx/src/Hook/Theme.php
----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------
 7 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
----------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/drupal-contri-d10/modules/contrib/nginx/nginx.info.yml
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
 1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
 1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
 1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
-------------------------------------------------------------------------------------------------------------

Time: 131ms; Memory: 10MB

Steps to reproduce

Run PHPCS on Config Pages module.

Proposed resolution

Fixed the coding standards.

Remaining tasks

Submit the patch either MR.

๐Ÿ“Œ Task
Status

RTBC

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia bhaveshdas

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 @bhaveshdas
  • Assigned to hetal.solanki
  • Merge request !3Fixed Issue โ†’ (Open) created by hetal.solanki
  • Issue was unassigned.
  • Status changed to Needs review 3 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dev2.addweb

    nilesh.addweb โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dev2.addweb

    I have fixed the below-listed errors. Please check.

    FILE: /home/addweb/patches/nginx-3461709/src/Service/NginxSite.php
    -------------------------------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 2 LINES
    -------------------------------------------------------------------------------------------------------------------------
     37 | ERROR | [x] The first parameter of a multi-line function declaration must be on the line after the opening bracket
     38 | ERROR | [x] Multi-line function declaration not indented correctly; expected 4 spaces but found 6
     38 | ERROR | [x] The closing parenthesis of a multi-line function declaration must be on a new line
    -------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------
    
  • Status changed to Needs work 3 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines cleavinjosh

    Hi @nilesh.addweb,

    Thank you for your MR.

    This is the only issue remaining after I ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml.

    โžœ  contrib phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml nginx
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/nginx/src/Service/NginxSite.php
    -------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------
     39 | 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: 165ms; Memory: 10MB
    
    โžœ  contrib

    Thank you.

  • Status changed to RTBC 3 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia hetal.solanki

    @cleavinjosh

    As i have run phpcs command all error are resolve so i am moving to RTBC.

    Thank you!!

Production build 0.71.5 2024