Fix the issues reported by phpcs

Created on 16 February 2023, almost 2 years ago
Updated 3 March 2023, over 1 year ago

Problem/Motivation

Checking PHPCS with Drupal standard on core's module return:

FILE: ...dules/tracker/tests/src/Kernel/Migrate/d7/MigrateTrackerSettingsTest.php
------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------
14 | ERROR | Missing member variable doc comment
------------------------------------------------------------------------------

FILE: ...rojects/core10/core/modules/tracker/tests/src/Functional/TrackerTest.php
------------------------------------------------------------------------------
FOUND 6 ERRORS AND 2 WARNINGS AFFECTING 8 LINES
------------------------------------------------------------------------------
58 | ERROR | [x] Missing function doc comment
63 | ERROR | [ ] The array declaration extends to column 103 (the limit
| | is 80). The array content should be split up over
| | multiple lines
96 | ERROR | [ ] The array declaration extends to column 204 (the limit
| | is 80). The array content should be split up over
| | multiple lines
182 | ERROR | [ ] The array declaration extends to column 204 (the limit
| | is 80). The array content should be split up over
| | multiple lines
209 | ERROR | [ ] The array declaration extends to column 204 (the limit
| | is 80). The array content should be split up over
| | multiple lines
335 | WARNING | [x] There must be no blank line following an inline comment
338 | WARNING | [x] There must be no blank line following an inline comment
468 | ERROR | [x] Parameter comment must end with a full stop
------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------

FILE: ...re10/core/modules/tracker/tests/src/Functional/TrackerNodeAccessTest.php
------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------
36 | ERROR | [x] Missing function doc comment
------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------

FILE: /home/tra/projects/core10/core/modules/tracker/tracker.module
------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
------------------------------------------------------------------------------
93 | WARNING | [x] There must be no blank line following an inline comment
266 | ERROR | [ ] Type hint "\Drupal\node\NodeInterface" missing for $node
323 | WARNING | [x] There must be no blank line following an inline comment
------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------

Steps to reproduce

Just run
phpcs --standard=Drupal --extensions=module,php,yml,twig,html core/modules/tracker

Proposed resolution

Fix it

Remaining tasks

N/A

User interface changes

N/A

API changes

N/A

Data model changes

N/A

📌 Task
Status

RTBC

Version

1.0

Component

Miscellaneous

Created by

🇻🇳Vietnam tra.duong

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.

  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Comments & Activities

  • Issue created by @tra.duong
  • Status changed to Needs review almost 2 years ago
  • 🇻🇳Vietnam tra.duong

    I add patch to fix the PHPCS, please review

  • Assigned to arunkumark
  • Status changed to Needs work almost 2 years ago
  • 🇮🇳India arunkumark Coimbatore

    The patch applied cleanly but there are few Coding standard issues.

    FILE: /var/www/html/web/modules/custom/tracker/tests/src/Functional/TrackerTest.php
    -----------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------
     423 | WARNING | Unused variable $unpublished.
    -----------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/modules/custom/tracker/tracker.views.inc
    -----------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------
     160 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
    -----------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/modules/custom/tracker/src/Controller/TrackerController.php
    ------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------------------
     214 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
    ------------------------------------------------------------------------------------------------------------------------------------------
  • Issue was unassigned.
  • 🇮🇳India Akram Khan Cuttack, Odisha

    Updated patch fixed remaining PHPCS error left with 1 that is "423 | WARNING | Unused variable $unpublished."

  • 🇮🇳India arunkumark Coimbatore

    Applied the patch, It applies cleanly. But there is one unresolved warning on the TrackerTest.php

    FILE: /var/www/html/web/modules/custom/tracker/tests/src/Functional/TrackerTest.php
    -----------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------
     408 | WARNING | Unused variable $unpublished.
    -----------------------------------------------------------------------------------
    
  • Status changed to Needs review almost 2 years ago
  • 🇮🇳India _pratik_ Banglore

    Please review thanks.

  • 🇮🇳India mrinalini9 New Delhi

    Changes in patch #9 are not correct, why remove the node creation part?

    Added patch by fixing warnings in #8, please review it.

    Thanks!

  • Status changed to RTBC almost 2 years ago
  • 🇮🇳India arunkumark Coimbatore

    The patch was applied cleanly and resolved all the PHPCS issues.

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

    Hi,

    I reviewed and tested patch #10. Worked fine for me.

    Applied smoothly.

    urvasi@urvasi-Inspiron-15-3552:/var/www/html/contribution/drupal8/web/modules/contrib/tracker-3342301$ git apply -v 3342301-10.patch
    Checking patch src/Controller/TrackerController.php...
    Checking patch tests/src/Functional/TrackerNodeAccessTest.php...
    Checking patch tests/src/Functional/TrackerTest.php...
    Checking patch tests/src/Kernel/Migrate/d7/MigrateTrackerSettingsTest.php...
    Checking patch tracker.module...
    Checking patch tracker.views.inc...
    Applied patch src/Controller/TrackerController.php cleanly.
    Applied patch tests/src/Functional/TrackerNodeAccessTest.php cleanly.
    Applied patch tests/src/Functional/TrackerTest.php cleanly.
    Applied patch tests/src/Kernel/Migrate/d7/MigrateTrackerSettingsTest.php cleanly.
    Applied patch tracker.module cleanly.
    Applied patch tracker.views.inc cleanly.
    

    Thanks for the work.

    Committing the changes for helping the maintainers.

  • @urvashi_vora opened merge request.
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
Production build 0.71.5 2024