Comply Drupal coding standards

Created on 6 October 2024, 4 months ago

Problem/Motivation

Everybody likes shiny and beautiful code.

Steps to reproduce

  • Add drupal/core-dev as a dev dependency (this will include PHPCodeSniffer and Drupal standards).
  • Run vendor/bin/phpcs --standard=Drupal -s --extensions=php,module,inc,install,test web/modules/contrib/certificatelogin.
  • Run vendor/bin/phpcs --standard=DrupalPractice -s --extensions=php,module,inc,install,test web/modules/contrib/certificatelogin

Please, find attached logs with the current output of the commands above.

Proposed resolution

  • Run phpcbf --standard=Drupal --ignore=vendor/*,node_modules/* --extensions=php,module,inc,install,test web/modules/contrib/certificatelogin
  • Run phpcbf --standard=DrupalPractice --ignore=vendor/*,node_modules/* --extensions=php,module,inc,install,test web/modules/contrib/certificatelogin

Remaining tasks

  • Fork the issue.
  • Provide a fix.

User interface changes

N/A

API changes

N/A

Data model changes

N/A

šŸ“Œ Task
Status

Active

Version

2.0

Component

Code

Created by

šŸ‡ŖšŸ‡øSpain d70rr3s

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

Merge Requests

Comments & Activities

  • Issue created by @d70rr3s
  • šŸ‡®šŸ‡³India arunsahijpal

    Working on it!

  • šŸ‡®šŸ‡³India arunsahijpal

    Fixed the phpcs issues.

  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi

    I applied MR !6 and I can still see many PHPCS issues

    āžœ  certificatelogin git:(2.x) curl https://git.drupalcode.org/project/certificatelogin/-/merge_requests/6.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 38848    0 38848    0     0  61051      0 --:--:-- --:--:-- --:--:-- 61859
    patching file certificatelogin.install
    patching file certificatelogin.module
    patching file 'src/Annotation/CaSignatureVerificationPlugin.php'
    patching file 'src/Controller/CertificateLoginController.php'
    patching file 'src/Form/CertificateLoginSettingsForm.php'
    patching file 'src/Form/ConfirmForm.php'
    patching file 'src/Form/LoginForm.php'
    patching file 'src/Plugin/Block/CertificateLoginBlock.php'
    patching file 'src/Plugin/CaSignatureVerificationPlugin/PHPSecLib.php'
    patching file 'src/Plugin/CaSignatureVerificationPluginBase.php'
    patching file 'src/Plugin/CaSignatureVerificationPluginInterface.php'
    patching file 'src/Plugin/CaSignatureVerificationPluginManager.php'
    patching file 'src/Plugin/Menu/LoginLogoutMenuLink.php'
    patching file 'src/Service/LoginRegisterService.php'
    āžœ  certificatelogin git:(2.x) āœ— ..
    āžœ  contrib git:(2.1.x) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml certificatelogin 
    
    FILE: ...s/clarksubing-subing/Projects/drupal-issues/drupal-contrib/web/modules/contrib/certificatelogin/css/certificatelogin.css
    ------------------------------------------------------------------------------------------------------------------------------
    FOUND 54 ERRORS AFFECTING 18 LINES
    ------------------------------------------------------------------------------------------------------------------------------
      7 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
      7 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
      7 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
      8 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
      8 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
      8 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
      9 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
      9 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
      9 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
     10 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
     10 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
     10 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
     11 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
     11 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
     11 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
     12 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
     12 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
     12 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
     13 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
     13 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
     13 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
     14 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
     14 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
     14 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
     15 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
     15 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
     15 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
     16 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
     16 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
     16 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
     17 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
     17 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
     17 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
     18 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
     18 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
     18 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
     19 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
     19 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
     19 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
     20 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
     20 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
     20 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
     24 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
     24 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
     24 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
     25 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
     25 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
     25 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
     29 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
     29 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
     29 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
     30 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
     30 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
     30 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
    ------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 54 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/clarksubing-subing/Projects/drupal-issues/drupal-contrib/web/modules/contrib/certificatelogin/README.md
    --------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
    --------------------------------------------------------------------------------------------------------------------
     14 | WARNING | Line exceeds 80 characters; contains 103 characters
     15 | WARNING | Line exceeds 80 characters; contains 131 characters
     23 | WARNING | Line exceeds 80 characters; contains 92 characters
     34 | WARNING | Line exceeds 80 characters; contains 104 characters
     46 | WARNING | Line exceeds 80 characters; contains 96 characters
     47 | WARNING | Line exceeds 80 characters; contains 107 characters
    --------------------------------------------------------------------------------------------------------------------
    
    
    FILE: ...s/clarksubing-subing/Projects/drupal-issues/drupal-contrib/web/modules/contrib/certificatelogin/certificatelogin.install
    ------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------
     9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
       |       |     Drupal\certificatelogin\Controller\CertificateLoginController.
    ------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: ...arksubing-subing/Projects/drupal-issues/drupal-contrib/web/modules/contrib/certificatelogin/certificatelogin.routing.yml
    ------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------
     37 | 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: ...ers/clarksubing-subing/Projects/drupal-issues/drupal-contrib/web/modules/contrib/certificatelogin/src/Form/LoginForm.php
    ------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
       |       |     Drupal\certificatelogin\Service\LoginRegisterService.
    ------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: ...ing/Projects/drupal-issues/drupal-contrib/web/modules/contrib/certificatelogin/src/Form/CertificateLoginSettingsForm.php
    ------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
       |       |     Drupal\certificatelogin\Plugin\CaSignatureVerificationPluginManager.
    ------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: ...Projects/drupal-issues/drupal-contrib/web/modules/contrib/certificatelogin/src/Controller/CertificateLoginController.php
    ------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
       |       |     Drupal\certificatelogin\Service\LoginRegisterService.
    ------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: ...g-subing/Projects/drupal-issues/drupal-contrib/web/modules/contrib/certificatelogin/src/Service/LoginRegisterService.php
    ------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
       |       |     Drupal\certificatelogin\Plugin\CaSignatureVerificationPluginManager.
    ------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------
    
    Time: 388ms; Memory: 12MB
    
    āžœ  contrib git:(2.1.x) āœ— 
    
  • šŸ‡®šŸ‡³India arunsahijpal

    Fixed the remaining phpcs errors, kindly check it.

  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi

    I applied the updated MR !6 and I confirmed that all PHPCS issues were fixed.

    āžœ  certificatelogin git:(2.x) curl https://git.drupalcode.org/project/certificatelogin/-/merge_requests/6.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 49212    0 49212    0     0  76934      0 --:--:-- --:--:-- --:--:-- 77499
    patching file README.md
    patching file certificatelogin.install
    patching file certificatelogin.module
    patching file certificatelogin.routing.yml
    patching file 'css/certificatelogin.css'
    patching file 'src/Annotation/CaSignatureVerificationPlugin.php'
    patching file 'src/Controller/CertificateLoginController.php'
    patching file 'src/Form/CertificateLoginSettingsForm.php'
    patching file 'src/Form/ConfirmForm.php'
    patching file 'src/Form/LoginForm.php'
    patching file 'src/Plugin/Block/CertificateLoginBlock.php'
    patching file 'src/Plugin/CaSignatureVerificationPlugin/PHPSecLib.php'
    patching file 'src/Plugin/CaSignatureVerificationPluginBase.php'
    patching file 'src/Plugin/CaSignatureVerificationPluginInterface.php'
    patching file 'src/Plugin/CaSignatureVerificationPluginManager.php'
    patching file 'src/Plugin/Menu/LoginLogoutMenuLink.php'
    patching file 'src/Service/LoginRegisterService.php'
    āžœ  certificatelogin git:(2.x) āœ— ..
    āžœ  contrib git:(2.1.x) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml certificatelogin 
    āžœ  contrib git:(2.1.x) āœ— 
    
Production build 0.71.5 2024