Fix the issues reported by phpcs

Created on 11 July 2024, 3 months ago
Updated 10 September 2024, about 1 month ago

Problem/Motivation

command -:
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig web/modules/contrib/paragraph_locator/

FILE: /var/www/html/d10/web/modules/contrib/paragraph_locator/README.md
-----------------------------------------------------------------------
FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
-----------------------------------------------------------------------
  6 | WARNING | Line exceeds 80 characters; contains 292 characters
 10 | WARNING | Line exceeds 80 characters; contains 155 characters
 11 | WARNING | Line exceeds 80 characters; contains 151 characters
 12 | WARNING | Line exceeds 80 characters; contains 186 characters
 13 | WARNING | Line exceeds 80 characters; contains 189 characters
 39 | WARNING | Line exceeds 80 characters; contains 85 characters
-----------------------------------------------------------------------


FILE: /var/www/html/d10/web/modules/contrib/paragraph_locator/config/install/views.view.paragraph_locator.yml
-------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
 627 | ERROR | [x] Expected 1 newline at end of file; 2 found
-------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/d10/web/modules/contrib/paragraph_locator/src/Controller/ParagraphLocator.php
---------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------------
 8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Symfony\Component\HttpFoundation\JsonResponse.
---------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/d10/web/modules/contrib/paragraph_locator/src/ParagraphLocatorHelper.php
--------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------
 44 | ERROR | [x] Separate the @param and @return sections by a blank line.
--------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------


FILE: /var/www/html/d10/web/modules/contrib/paragraph_locator/paragraph_locator.module
---------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------
 9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Routing\RouteMatchInterface.
---------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/d10/web/modules/contrib/paragraph_locator/js/paragraph-locator.js
---------------------------------------------------------------------------------------------
FOUND 8 ERRORS AFFECTING 8 LINES
---------------------------------------------------------------------------------------------
  9 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 10 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 27 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 30 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 56 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 59 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 70 | ERROR | [x] Whitespace found at end of line
 80 | ERROR | [x] Expected 1 space after "+"; 0 found
---------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------

Time: 188ms; Memory: 12MB

Steps to reproduce

Run PHPCS on Config Pages module.

Proposed resolution

Fixed the coding standards.

Remaining tasks

Submit the patch either MR.

📌 Task
Status

Needs review

Version

1.0

Component

Code

Created by

🇮🇳India hetal.solanki

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

Merge Requests

Comments & Activities

  • Issue created by @hetal.solanki
  • 🇮🇳India hetal.solanki

    Hetal.Solanki → changed the visibility of the branch 3460744- to hidden.

  • Merge request !1Fixed PHPHCS issue → (Open) created by hetal.solanki
  • Issue was unassigned.
  • Status changed to Needs review 3 months ago
  • Status changed to Needs work 3 months ago
  • 🇮🇳India dev2.addweb

    The patch is not applied successfully. I have installed the [ 1.0.1 ] version.

  • Status changed to Needs review 3 months ago
  • 🇵🇭Philippines cleavinjosh

    Hi,

    I provide a patch that fixes some of the phpcs issues. These are the remaining issues.

    ➜  contrib git:(main) ✗ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml paragraph_locator
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/paragraph_locator/README.md
    ------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
    ------------------------------------------------------------------------------------------------
      6 | WARNING | Line exceeds 80 characters; contains 292 characters
     10 | WARNING | Line exceeds 80 characters; contains 155 characters
     11 | WARNING | Line exceeds 80 characters; contains 151 characters
     12 | WARNING | Line exceeds 80 characters; contains 186 characters
     13 | WARNING | Line exceeds 80 characters; contains 189 characters
     39 | WARNING | Line exceeds 80 characters; contains 85 characters
    ------------------------------------------------------------------------------------------------
    
    Time: 133ms; Memory: 10MB

    Please review.

    Thank you.

  • Status changed to RTBC 3 months ago
  • 🇮🇳India bhaveshdas

    I have tested Phpcs issues MR 1 and it is working properly with no errors found.
    I will move it forward to RTBC.

    Thankyou!

  • Status changed to Needs work about 1 month ago
  • 🇮🇳India diwakar07

    Thanks for the work on this.

    Please resolve merge conflicts.

  • Status changed to Needs review about 1 month ago
  • 🇵🇭Philippines cleavinjosh

    Hi @diwakar07,

    Please review MR!1. Thank you.

  • 🇮🇳India rohan_singh India

    Hi @cleavinjosh, I have applied the provided MR as a patch and it applied cleanly with no errors. I can confirm that the phpcs issues have been resolved successfully however I am getting some console errors and due to these errors, the module is not working as expected. I am attaching the screenshots below.

  • 🇮🇳India kulpratap2002

    @rohan_singh I tried to solve the errors that are present in the console but the error is due to the capital 'TRUE' & 'FALSE' in js file, if we write true and false instead of TRUE and FALSE the error goes away, but if we write 'true' and 'false' it is showing phpcs error and it is giving console error, and there is one more issue is that it is not deleting the paragraph because there is one function is missing ( paragraphParent() ) in the ParagraphLocator.php.

Production build 0.71.5 2024