Fix the issues reported by phpcs

Created on 8 July 2024, 2 months ago
Updated 19 July 2024, about 2 months ago

Problem/Motivation

Running :-
vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig web/modules/contrib/cdt/
returns the following warnings/errors, which should be fixed.

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/cdt/content_dependency_tracker/content_dependency_tracker.module
-----------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
-----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/cdt/content_dependency_tracker/src/ReferenceFinder.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 9 ERRORS AND 4 WARNINGS AFFECTING 13 LINES
-------------------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\EntityFieldManagerInterface.
11 | ERROR | [x] Missing class doc comment
13 | ERROR | [ ] Missing member variable doc comment
14 | ERROR | [ ] Missing member variable doc comment
15 | ERROR | [ ] Missing member variable doc comment
23 | ERROR | [x] Missing function doc comment
38 | WARNING | [ ] Line exceeds 80 characters; contains 97 characters
48 | WARNING | [ ] Line exceeds 80 characters; contains 101 characters
66 | ERROR | [x] Missing function doc comment
67 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
73 | WARNING | [ ] Line exceeds 80 characters; contains 95 characters
86 | ERROR | [x] Expected 1 blank line after function; 0 found
87 | ERROR | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/cdt/content_dependency_tracker/src/Form/ContentDependencyTrackerAdminForm.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 7 ERRORS AND 1 WARNING AFFECTING 8 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\ConfigFormBase.
9 | ERROR | [x] Missing class doc comment
41 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
48 | ERROR | [ ] The array declaration extends to column 133 (the limit is 120). The array content should be split up over multiple lines
51 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
95 | ERROR | [x] list(...) is forbidden, use [...] instead.
106 | ERROR | [x] Expected 1 blank line after function; 0 found
107 | ERROR | [x] The closing brace for the class must have an empty line before it
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/cdt/content_dependency_tracker/src/EventSubscriber/FormAlterSubscriber.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 9 ERRORS AND 1 WARNING AFFECTING 10 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\content_dependency_tracker\ReferenceFinder.
14 | ERROR | [x] Missing class doc comment
17 | ERROR | [ ] Missing member variable doc comment
18 | ERROR | [ ] Missing member variable doc comment
19 | ERROR | [ ] Missing member variable doc comment
27 | ERROR | [x] Missing function doc comment
34 | ERROR | [x] Missing function doc comment
45 | WARNING | [ ] Unused variable $field_name.
79 | ERROR | [x] Expected 1 blank line after function; 0 found
80 | ERROR | [x] The closing brace for the class must have an empty line before it
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/cdt/content_dependency_tracker/content_dependency_tracker.info.yml
-------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
-------------------------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/cdt/README.txt
-------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------
1 | WARNING | [ ] File has mixed line endings; this may cause incorrect results
1 | WARNING | [ ] File encoding is invalid, expected UTF-8
1 | ERROR | [ ] File contains UTF-16 (LE) byte order mark, which may corrupt your application
2 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------

Time: 139ms; Memory: 10MB

Steps to reproduce

Proposed resolution

Remaining tasks

Create The Mr/ Patch

User interface changes

API changes

Data model changes

📌 Task
Status

RTBC

Version

1.0

Component

Code

Created by

🇮🇳India Prem Suthar gujrat

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 @Prem Suthar
  • First commit to issue fork.
  • Assigned to Chandansha
  • Status changed to Needs review 2 months ago
  • Issue was unassigned.
  • Status changed to Needs work 2 months ago
  • 🇮🇳India bhaveshdas

    I applied MR!1 and I still encountered some issues after I ran vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig modules/custom/cdt-3459854/

    FILE: /var/www/html/drupal-contri-d10/modules/custom/cdt-3459854/content_dependency_tracker/src/EventSubscriber/FormAlterSubscriber.php
    ---------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------
     77 | WARNING | Unused variable $field_name.
    ---------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 124ms; Memory: 10MB
    
  • First commit to issue fork.
  • Status changed to Needs review about 2 months ago
  • 🇵🇭Philippines paraderojether

    I fix the remaining issue, please review.

    Thank you.

  • Assigned to Hetal.Solanki
  • Issue was unassigned.
  • Status changed to RTBC about 2 months ago
  • 🇮🇳India Hetal.Solanki

    I have reviewed MR !2, and it is working properly with no errors found.
    I am moving it forward to RTBC.
    Thank you!!

Production build 0.71.5 2024