Fix coding standard issue | PHPCS

Created on 8 February 2023, almost 2 years ago
Updated 24 March 2023, over 1 year ago

Problem/Motivation

Fix the following issues from PHPCS.

FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/node_keep/node_keep.module
------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------
62 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
77 | ERROR | [x] Expected 1 space after IF keyword; 0 found
------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------

FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/node_keep/node_keep_token/node_keep_token.module
-----------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------------------
146 | ERROR | Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
150 | ERROR | Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
154 | ERROR | Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
-----------------------------------------------------------------------------------------------------------------------

FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/node_keep/node_keep_token/src/NodeKeepTokenService.php
-------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
140 | ERROR | Parameter $exception_nid is not described in comment
-------------------------------------------------------------------------------------------------------------

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇮🇳India noorulshameera

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

Comments & Activities

  • Issue created by @noorulshameera
  • Status changed to Needs review almost 2 years ago
  • 🇮🇳India noorulshameera

    Adding a patch to fix the issues.

  • Assigned to samit.310@gmail.com
  • 🇮🇳India samit.310@gmail.com

    I will review patch #2 📌 Fix coding standard issue | PHPCS Fixed

  • Status changed to Needs work almost 2 years ago
  • 🇮🇳India samit.310@gmail.com

    Hi @noorulshameera, following errors are still exists after applying #2 📌 Fix coding standard issue | PHPCS Fixed Patch.

    FILE: /var/www/html/modules/contrib/node_keep/node_keep.module
    -----------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------
    160 | WARNING | Only string literals should be passed to t() where possible
    -----------------------------------------------------------------------------

    FILE: /var/www/html/modules/contrib/node_keep/node_keep_token/node_keep_token.module
    ------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
    ------------------------------------------------------------------------------------
    141 | WARNING | Unused variable $nid.
    145 | WARNING | Only string literals should be passed to t() where possible
    149 | WARNING | Only string literals should be passed to t() where possible
    153 | WARNING | Only string literals should be passed to t() where possible
    ------------------------------------------------------------------------------------

    FILE: /var/www/html/modules/contrib/node_keep/node_keep_token/src/NodeKeepTokenService.php
    ----------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------
    190 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    ----------------------------------------------------------------------------------------------

    Time: 3.11 secs; Memory: 6MB

  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • 🇮🇳India samit.310@gmail.com

    New patch to fix above errors.

    interdiff with #2 📌 Fix coding standard issue | PHPCS Fixed

  • Status changed to RTBC almost 2 years ago
  • 🇮🇳India mrinalini9 New Delhi

    Reviewed patch #5, looks good to me. It applied cleanly and fixed all PHPCS errors and warnings.
    So, moving this to RTBC.

    Thanks & Regards,
    Mrinalini

  • First commit to issue fork.
  • 🇮🇳India urvashi_vora Madhya Pradesh, India

    Reviewed and tested patch #5

    urvasi@urvasi-Inspiron-15-3552:/var/www/html/contribution/drupal/web/modules/contrib/node_keep-3340281$ git apply -v 3340281-5.patch
    Checking patch node_keep.module...
    Checking patch node_keep_token/node_keep_token.module...
    Checking patch node_keep_token/node_keep_token.services.yml...
    Checking patch node_keep_token/src/NodeKeepTokenService.php...
    Applied patch node_keep.module cleanly.
    Applied patch node_keep_token/node_keep_token.module cleanly.
    Applied patch node_keep_token/node_keep_token.services.yml cleanly.
    Applied patch node_keep_token/src/NodeKeepTokenService.php cleanly.

    It was applied smoothly.

    RTBC++

    Committing the changes to help the maintainers.

  • @urvashi_vora opened merge request.
  • Status changed to Fixed over 1 year ago
  • 🇺🇦Ukraine nginex

    Thanks for the patch.

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

Production build 0.71.5 2024