Fix the issues reported by phpcs

Created on 21 April 2023, over 1 year ago
Updated 3 May 2023, over 1 year ago

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

FILE: .../web/modules/contrib/layout_builder_browser/layout_builder_browser.api.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
19 | ERROR | [ ] Missing parameter name
22 | ERROR | [x] Expected 1 blank line before function; 2 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...odules/contrib/layout_builder_browser/src/Controller/BrowserController.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
24 | WARNING | [ ] The class short comment should describe what the class
| | does and not simply repeat the class name
231 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: $region
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...dules/contrib/layout_builder_browser/src/Form/BlockCategoryListingForm.php
--------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
37 | ERROR | [ ] The array declaration extends to column 99 (the limit is 80).
| | The array content should be split up over multiple lines
37 | ERROR | [x] Comma not allowed after last value in single-line array
| | declaration
37 | ERROR | [x] Expected one space after the comma, 0 found
38 | ERROR | [ ] The array declaration extends to column 99 (the limit is 80).
| | The array content should be split up over multiple lines
38 | ERROR | [x] Comma not allowed after last value in single-line array
| | declaration
38 | ERROR | [x] Expected one space after the comma, 0 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...b/web/modules/contrib/layout_builder_browser/src/Form/BlockListingForm.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 3 WARNINGS AFFECTING 4 LINES
--------------------------------------------------------------------------------
193 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: 'draggable'
265 | ERROR | [ ] The array declaration extends to column 90 (the limit is
| | 80). The array content should be split up over multiple
| | lines
265 | ERROR | [ ] The array declaration extends to column 89 (the limit is
| | 80). The array content should be split up over multiple
| | lines
335 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
345 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...drupalvb/web/modules/contrib/layout_builder_browser/src/Form/BlockForm.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AND 4 WARNINGS AFFECTING 7 LINES
--------------------------------------------------------------------------------
42 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
77 | WARNING | [ ] Line exceeds 80 characters; contains 103 characters
92 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: 'block-id-wrapper'
122 | ERROR | [x] Functions must not contain multiple empty lines in a row;
| | found 2 empty lines
137 | ERROR | [x] Functions must not contain multiple empty lines in a row;
| | found 2 empty lines
139 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
209 | ERROR | [x] Missing function doc comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...es/contrib/layout_builder_browser/src/Entity/LayoutBuilderBrowserBlock.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
99 | ERROR | [x] The closing brace for the class must have an empty line
| | before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...b/web/modules/contrib/layout_builder_browser/layout_builder_browser.module
--------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
--------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
5 | ERROR | [x] Missing function doc comment
7 | ERROR | [x] Expected 1 space after IF keyword; 0 found
38 | ERROR | [x] Expected 1 newline at end of file; 2 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: .../web/modules/contrib/layout_builder_browser/layout_builder_browser.install
--------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
41 | ERROR | [x] Expected 1 space(s) after cast statement; 0 found
58 | ERROR | [ ] Doc comment short description must start with a capital
| | letter
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 1.66 secs; Memory: 14MB

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India dineshkumarbollu

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

Comments & Activities

  • Issue created by @dineshkumarbollu
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India Nishant

    I have reviewed your patch #2, This is working fine.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    +/**
    + * @file
    + * Install, update and uninstall functions for the layout builder browser.
    + */
    +

    There is a missing comma before and.

    - * #3184784: Ensure block config entity is installed on existing sites.
    + * Ensure block config entity is installed on existing sites(#3184784).

    There is a missing space before the opening parenthesis.

    +/**
    + * @file
    + * Defines hooks of the layout bulder browser module.
    + */

    The correct short description for the module is Hook implementations for the Layout Builder Browser module.

    +/**
    + * {@inheritdoc}
    + */
     function layout_builder_browser_link_alter(&$variables) {

    That is not the documentation comment used from hook implementations.

     /**
    - * Class BrowserController.
    + * Defines BrowserController class.
      */
     class BrowserController extends ControllerBase {

    The short description is still repeating the class name and it does not say anything about its purpose.

    +  /**
    +   * The Block manager.
    +   *
    +   * @var \Drupal\Core\Block\BlockManagerInterface
    +   */
    +  protected $blockManager;

    Block is misspelled, since it is not at the beginning of the sentence.

    +   * @param \Drupal\Core\Block\BlockManagerInterface $blockManager
    +   *   The blockManager.

    The correct description is the one previously used, once Block is corrected.

  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India Akram Khan Cuttack, Odisha

    addressed #4

  • Status changed to Fixed over 1 year ago
  • 🇫🇷France vbouchet

    Thanks all for reporting, reviewing and fixing these coding standards. I adapted few things which did not apply anymore after some recent change in the code base.

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

Production build 0.71.5 2024