Fix the issues reported by phpcs

Created on 27 April 2023, about 1 year ago
Updated 30 May 2023, about 1 year ago

Issues Found BY checking phpcs :

FILE: C:\wamp64\www\my_site_name_dir\web\modules\Contrib\component_blocks-3356835\README.txt
--------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------
32 | WARNING | Line exceeds 80 characters; contains 83 characters
--------------------------------------------------------------------------------------------
FILE: C:\wamp64\www\my_site_name_dir\web\modules\Contrib\component_blocks-3356835\component_blocks.module
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
23 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
26 | WARNING | [ ] Unused variable $storage.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Please Use This Command to test The remaining coding standard issues:

phpcs --standard=drupal,drupalpractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml README.txt

phpcs --standard=drupal,drupalpractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml component_blocks.module

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India Rohit Rana

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 @Rohit Rana
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 5.3 & MySQL 5.5
    last update about 1 year ago
    Composer error. Unable to continue.
  • Status changed to Needs work about 1 year ago
  • 🇵🇭Philippines clarkssquared

    Hi Rohit Rana

    I applied your patch #2 to Component blocks module against version 1.0.x-dev and confirmed that PHPCS issues relating to ComponentBlock.php were fixed. However, when I ran through PHPCS testing for the entire module there are PHPCS warnings being flagged. Moving this to Needs Work for your opinion and also the maintainers if the remaining PHPCS issues should be addressed.

    Please look at the screenshots attached for your reference.

    Thank you.

  • First commit to issue fork.
  • Assigned to shalini_jha
  • 🇮🇳India shalini_jha

    i will work on it.

  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • 🇮🇳India shalini_jha

    Fixed remaining issues, please review.

  • Status changed to Needs work about 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    The issue summary should always describe what the issue is trying to fix and, in the case, of coding standards issues, show which command has been used, which arguments have been used, and which report that command shown.

  • Status changed to Needs review about 1 year ago
  • Status changed to Needs work about 1 year ago
  • 🇮🇳India Anmol_Specbee

    The patch is not solving all the issues. Adding a screenshot for reference.

  • Assigned to akshaydalvi212
  • 🇮🇳India akshaydalvi212

    I will work on this and will provide new patch file and interdiff file.

  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • 🇮🇳India akshaydalvi212

    kindly review the new patch file.
    interdiff file is also provided.

  • 🇮🇳India arpitk

    Hi The patch #12 applied cleanily. No more errors/wrnings are shown anymore.
    Ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml . to check.

    Thanks!

  • Status changed to Needs work about 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
     /**
    - * Implements theme_suggestions_HOOK_alter().
    + * Implements hook_theme_suggestions_block_alter().
      */
     function component_blocks_theme_suggestions_block_alter(&$hooks, &$vars) {

    The correct description is Implements hook_theme_suggestions_HOOK_alter(). (See hook_theme_suggestions_HOOK_alter().)

    -  if ($storage = \Drupal::routeMatch()->getParameter('section_storage')) {
    -    // This is layout builder.
    -    return;
    -  }

    Why are those lines removed?

    -      $formatter_configuration = array_intersect_key($configuration, ['type' => TRUE, 'settings' => TRUE]) + ['label' => 'hidden'];
    +      $formatter_configuration = array_intersect_key(
    +        $configuration,
    +        ['type' => TRUE, 'settings' => TRUE]) + ['label' => 'hidden'];

    I would leave the code as it is, since code lines are allowed to exceed 80 characters, especially when they are easier to read.

  • Status changed to Needs review about 1 year ago
  • 🇮🇳India mrinalini9 New Delhi

    Updated patch #12 by addressing #14, please review it.

    Thanks!

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.2 & MySQL 8
    last update about 1 year ago
    Patch Failed to Apply
  • Status changed to Fixed about 1 year ago
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    Thanks @apaderno et al

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

Production build 0.69.0 2024