Fix the issues reported by phpcs

Created on 2 July 2024, 2 months ago
Updated 6 August 2024, about 1 month ago

Problem/Motivation

command -:
phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml web/modules/contrib/vpn_login/

FILE: /var/www/html/d10/web/modules/contrib/vpn_login/src/EventSubscriber/LoginSubscriber.php
--------------------------------------------------------------------------------------------------------------------------------------------
FOUND 11 ERRORS AND 1 WARNING AFFECTING 12 LINES
--------------------------------------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Symfony\Component\HttpKernel\Event\RequestEvent.
8 | WARNING | [x] Unused use statement
14 | ERROR | [x] Missing class doc comment
16 | ERROR | [ ] Missing member variable doc comment
18 | ERROR | [x] Missing function doc comment
22 | ERROR | [x] Missing function doc comment
27 | ERROR | [x] Missing function doc comment
52 | ERROR | [x] Expected newline after closing brace
67 | ERROR | [x] Separate the @param and @return sections by a blank line.
80 | ERROR | [x] Expected newline after closing brace
83 | ERROR | [x] Expected 1 blank line after function; 0 found
84 | ERROR | [x] The closing brace for the class must have an empty line before it
--------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 11 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/vpn_login/src/EventSubscriber/RouteSubscriber.php
---------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 3 LINES
---------------------------------------------------------------------------------------------
10 | ERROR | [x] Missing class doc comment
52 | ERROR | [x] Expected 1 blank line after function; 0 found
53 | ERROR | [x] Expected 1 newline at end of file; 2 found
53 | ERROR | [x] The closing brace for the class must have an empty line before it
---------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/vpn_login/src/Form/VpnLoginConfigForm.php
-------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
-------------------------------------------------------------------------------------
8 | ERROR | [x] Missing class doc comment
99 | ERROR | [x] Expected newline after closing brace
116 | ERROR | [x] Expected 1 blank line after function; 0 found
117 | ERROR | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/twig_tweak/twig_tweak.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
-------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/twig_tweak/tests/twig_tweak_test/twig_tweak_test.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: 1.09 secs; Memory: 14MB

Steps to reproduce

Run PHPCS on Config Pages module.

Proposed resolution

Fixed the coding standards.

Remaining tasks

Submit the patch either MR.

šŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India Hetal.Solanki

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 @Hetal.Solanki
  • Assigned to dev2.addweb
  • šŸ‡®šŸ‡³India Hetal.Solanki

    Hetal.Solanki ā†’ changed the visibility of the branch 3458455-dev to hidden.

  • Assigned to Hetal.Solanki
  • Merge request !2working on to fix codinig standerd ā†’ (Closed) created by Hetal.Solanki
  • Status changed to Needs review 2 months ago
  • Issue was unassigned.
  • Status changed to Needs work 2 months ago
  • šŸ‡®šŸ‡³India bhaveshdas

    i have tested MR 2 and i have found some error below:-
    use below this command-:vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig modules/custom/vpn_login-3458455/

    FILE: /var/www/html/drupal-contri-d10/modules/custom/vpn_login-3458455/src/EventSubscriber/LoginSubscriber.php
    --------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------
     44 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    --------------------------------------------------------------------------------------------------------------
    
    Time: 109ms; Memory: 10MB
  • Status changed to Needs review 2 months ago
  • šŸ‡®šŸ‡³India dev2.addweb

    Hi,
    I have fixed phpcs issue mention in #7, Please review it.

  • Status changed to RTBC 2 months ago
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi @nilesh.addweb,

    I applied MR!2, it was applied cleanly and fixes the issues.

    āžœ  vpn_login git:(main) āœ— curl https://git.drupalcode.org/project/vpn_login/-/merge_requests/2.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  5445    0  5445    0     0  10702      0 --:--:-- --:--:-- --:--:-- 10718
    patching file src/EventSubscriber/LoginSubscriber.php
    patching file src/EventSubscriber/RouteSubscriber.php
    patching file src/Form/VpnLoginConfigForm.php
    patching file vpn_login.services.yml
    āžœ  vpn_login git:(main) āœ— ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml vpn_login
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/vpn_login/vpn_login.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: 150ms; Memory: 10MB
    
    āžœ  contrib git:(main) āœ—

    Please ignore the issues that I encountered since it is because I downloaded the module via composer.

    I am now moving this to Reviewed & tested by the community.

    Thank you.

  • šŸ‡ØšŸ‡¦Canada smulvih2 Canada šŸ

    Thanks for all your work on this! Merged wth 1.0.x-dev and will be included in next release.

  • Status changed to Fixed about 2 months ago
  • šŸ‡ØšŸ‡¦Canada smulvih2 Canada šŸ

    Committed and attributed!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024