Phpcs standard fix for D10 version

Created on 6 October 2023, about 1 year ago
Updated 7 February 2024, 11 months ago

Getting following error for phpcs Drupal standard check.

./vendor/bin/phpcs --standard="Drupal,DrupalPractice" web/modules/contrib/bootstrap_layouts

FILE: /Users/madhume/workspace/drupal-10.1/web/modules/contrib/bootstrap_layouts/bootstrap_layouts.api.php
----------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------
17 | ERROR | Missing parameter type
----------------------------------------------------------------------------------------------------------

FILE: /Users/madhume/workspace/drupal-10.1/web/modules/contrib/bootstrap_layouts/src/BootstrapLayoutsUninstallValidator.php
---------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------------
9 | ERROR | [x] Doc comment short description must end with a full stop
10 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
---------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------

FILE: /Users/madhume/workspace/drupal-10.1/web/modules/contrib/bootstrap_layouts/src/BootstrapLayoutsPluginManager.php
----------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 3 WARNINGS AFFECTING 6 LINES
----------------------------------------------------------------------------------------------------------------------
16 | ERROR | [x] Missing class doc comment
21 | ERROR | [ ] Missing short description in doc comment
26 | ERROR | [ ] Missing short description in doc comment
53 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
58 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
68 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------

FILE: /Users/madhume/workspace/drupal-10.1/web/modules/contrib/bootstrap_layouts/src/Plugin/Layout/BootstrapLayoutsBase.php
--------------------------------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AND 3 WARNINGS AFFECTING 9 LINES
--------------------------------------------------------------------------------------------------------------------------------------------
11 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Layout\LayoutDefault.
21 | WARNING | [ ] Possible useless method overriding detected
134 | ERROR | [ ] The array declaration extends to column 93 (the limit is 80). The array content should be split up over multiple lines
140 | WARNING | [ ] #description values usually have to run through t() for translation
141 | ERROR | [ ] The array declaration extends to column 81 (the limit is 80). The array content should be split up over multiple lines
153 | ERROR | [x] Use null coalesce operator instead of ternary operator.
189 | WARNING | [ ] #description values usually have to run through t() for translation
253 | ERROR | [x] Expected 1 blank line after function; 0 found
254 | 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: /Users/madhume/workspace/drupal-10.1/web/modules/contrib/bootstrap_layouts/src/Plugin/BootstrapLayouts/BootstrapLayoutsUpdateBase.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------
11 | ERROR | [x] Missing class doc comment
-------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/madhume/workspace/drupal-10.1/web/modules/contrib/bootstrap_layouts/src/Plugin/BootstrapLayouts/Updates/BootstrapLayoutsUpdate8401.php
---------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------------------------
9 | ERROR | [x] Doc comment short description must end with a full stop
---------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/madhume/workspace/drupal-10.1/web/modules/contrib/bootstrap_layouts/src/Plugin/BootstrapLayouts/Updates/BootstrapLayoutsUpdate8402.php
---------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------------------------
9 | ERROR | [x] Doc comment short description must end with a full stop
---------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/madhume/workspace/drupal-10.1/web/modules/contrib/bootstrap_layouts/src/Plugin/BootstrapLayouts/BootstrapLayoutsUpdateInterface.php
------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------------------------------------
12 | ERROR | [x] Missing interface doc comment
32 | ERROR | [x] Doc comment star missing
33 | ERROR | [x] Additional blank lines found at end of doc comment
------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY

๐Ÿ› Bug report
Status

RTBC

Version

5.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia Madhu Kumar M E

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

Comments & Activities

  • Issue created by @Madhu Kumar M E
  • First commit to issue fork.
  • @shiv_yadav opened merge request.
  • Status changed to Needs review about 1 year ago
  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines clarkssquared

    Hi shiv,

    I applied and tested your patch and I confirmed that it applies cleanly but as I execute the PHPCS command there are many PHPCS issues that are flagged in my terminal, I am using D10.1.4.

    โžœ  bootstrap_layouts git:(f6b43a4) curl https://git.drupalcode.org/project/bootstrap_layouts/-/merge_requests/5.diff | git apply -v
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 22264    0 22264    0     0  40340      0 --:--:-- --:--:-- --:--:-- 40851
    Checking patch bootstrap_layouts.api.php...
    Checking patch bootstrap_layouts.install...
    Checking patch bootstrap_layouts.module...
    Checking patch src/Annotation/BootstrapLayoutsUpdate.php...
    Checking patch src/BootstrapLayout.php...
    Checking patch src/BootstrapLayoutsManager.php...
    Checking patch src/BootstrapLayoutsPluginManager.php...
    Checking patch src/BootstrapLayoutsUninstallValidator.php...
    Checking patch src/BootstrapLayoutsUpdateManager.php...
    Checking patch src/Plugin/BootstrapLayouts/BootstrapLayoutsHandlerBase.php...
    Checking patch src/Plugin/BootstrapLayouts/BootstrapLayoutsHandlerInterface.php...
    Checking patch src/Plugin/BootstrapLayouts/BootstrapLayoutsUpdateBase.php...
    Checking patch src/Plugin/BootstrapLayouts/BootstrapLayoutsUpdateInterface.php...
    Checking patch src/Plugin/BootstrapLayouts/Ds.php...
    Checking patch src/Plugin/BootstrapLayouts/PageManager.php...
    Checking patch src/Plugin/BootstrapLayouts/Updates/BootstrapLayoutsUpdate8401.php...
    Checking patch src/Plugin/BootstrapLayouts/Updates/BootstrapLayoutsUpdate8402.php...
    Checking patch src/Plugin/Layout/BootstrapLayoutsBase.php...
    Applied patch bootstrap_layouts.api.php cleanly.
    Applied patch bootstrap_layouts.install cleanly.
    Applied patch bootstrap_layouts.module cleanly.
    Applied patch src/Annotation/BootstrapLayoutsUpdate.php cleanly.
    Applied patch src/BootstrapLayout.php cleanly.
    Applied patch src/BootstrapLayoutsManager.php cleanly.
    Applied patch src/BootstrapLayoutsPluginManager.php cleanly.
    Applied patch src/BootstrapLayoutsUninstallValidator.php cleanly.
    Applied patch src/BootstrapLayoutsUpdateManager.php cleanly.
    Applied patch src/Plugin/BootstrapLayouts/BootstrapLayoutsHandlerBase.php cleanly.
    Applied patch src/Plugin/BootstrapLayouts/BootstrapLayoutsHandlerInterface.php cleanly.
    Applied patch src/Plugin/BootstrapLayouts/BootstrapLayoutsUpdateBase.php cleanly.
    Applied patch src/Plugin/BootstrapLayouts/BootstrapLayoutsUpdateInterface.php cleanly.
    Applied patch src/Plugin/BootstrapLayouts/Ds.php cleanly.
    Applied patch src/Plugin/BootstrapLayouts/PageManager.php cleanly.
    Applied patch src/Plugin/BootstrapLayouts/Updates/BootstrapLayoutsUpdate8401.php cleanly.
    Applied patch src/Plugin/BootstrapLayouts/Updates/BootstrapLayoutsUpdate8402.php cleanly.
    Applied patch src/Plugin/Layout/BootstrapLayoutsBase.php cleanly.
    โžœ  bootstrap_layouts git:(f6b43a4) โœ— ..
    โžœ  contrib git:(main) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml bootstrap_layouts 
    
    FILE: ...bing/Projects/PAT/drupal10/web/modules/contrib/bootstrap_layouts/README.md
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     3 | WARNING | Line exceeds 80 characters; contains 81 characters
    --------------------------------------------------------------------------------
    
    
    FILE: ...eb/modules/contrib/bootstrap_layouts/src/BootstrapLayoutsPluginManager.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
     67 | WARNING | \Drupal calls should be avoided in classes, use dependency
        |         | injection instead
     77 | WARNING | \Drupal calls should be avoided in classes, use dependency
        |         | injection instead
    --------------------------------------------------------------------------------
    
    
    FILE: ...dules/contrib/bootstrap_layouts/src/Plugin/Layout/BootstrapLayoutsBase.php
    --------------------------------------------------------------------------------
    FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
    --------------------------------------------------------------------------------
      21 | WARNING | Possible useless method overriding detected
     134 | ERROR   | The array declaration extends to column 93 (the limit is 80).
         |         | The array content should be split up over multiple lines
     141 | ERROR   | The array declaration extends to column 81 (the limit is 80).
         |         | The array content should be split up over multiple lines
    --------------------------------------------------------------------------------
    
    
    FILE: ...al10/web/modules/contrib/bootstrap_layouts/src/BootstrapLayoutsManager.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     281 | WARNING | Unused variable $handler_id.
    --------------------------------------------------------------------------------
    
    Time: 676ms; Memory: 12MB
    
    โžœ  contrib git:(main) โœ— 
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Gautam_105@

    Gautam_105@ โ†’ made their first commit to this issueโ€™s fork.

  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia shiv_yadav

    hello clarkssquared, fixed remianing issue. pending only three line comment.these are attribute test changes.attched screenshot as well.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Gautam_105@

    @clarkssquared ,
    i have fixed this issue and created MR for the same .please review and see screenshot as well

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Madhu Kumar M E

    @gautam I applied and tested your patch it working fine, still some warnings will be there but its not concern to fix it, attaching screenshot for ref for the same

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Gautam_105@

    @Madhu Kumar M E,
    i have updated MR Please review this and see the screenshot as well.

  • Status changed to RTBC 11 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia pray_12

    Hi,
    MR!5 [#10] fixes all the Phpcs errors and warnings.

Production build 0.71.5 2024