Fix the issues reported by phpcs

Created on 6 July 2023, over 1 year ago

Problem/Motivation

FILE: /var/www/html/vb/d_cont/config_track/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
5 | WARNING | Line exceeds 80 characters; contains 125 characters
7 | WARNING | Line exceeds 80 characters; contains 206 characters
----------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/config_track/config_track.install
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
65 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced
| | with use statements
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...r/www/html/vb/d_cont/config_track/src/Controller/ConfigTrackController.php
--------------------------------------------------------------------------------
FOUND 4 ERRORS AND 5 WARNINGS AFFECTING 9 LINES
--------------------------------------------------------------------------------
133 | WARNING | [ ] User::load calls should be avoided in classes, use
| | dependency injection instead
140 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: ]
153 | ERROR | [ ] Missing parameter type
201 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
210 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
211 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
226 | ERROR | [ ] Missing parameter type
249 | ERROR | [ ] Missing parameter type
263 | ERROR | [ ] The array declaration extends to column 109 (the limit is
| | 80). The array content should be split up over multiple
| | lines
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: .../html/vb/d_cont/config_track/src/EventSubscriber/ConfigTrackSubscriber.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AND 1 WARNING AFFECTING 4 LINES
--------------------------------------------------------------------------------
3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin
| | with a file doc comment
133 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
170 | ERROR | [ ] The array declaration extends to column 99 (the limit is
| | 80). The array content should be split up over multiple
| | lines
171 | ERROR | [ ] The array declaration extends to column 103 (the limit is
| | 80). The array content should be split up over multiple
| | lines
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/config_track/src/Extension/ModuleHandler.php
------------------------------------------------------------------------------
FOUND 10 ERRORS AFFECTING 9 LINES
------------------------------------------------------------------------------
38 | ERROR | [ ] Parameter $inner_module_handler is not described in comment
41 | ERROR | [ ] Missing parameter name
59 | ERROR | [x] Expected 1 space after IF keyword; 0 found
64 | ERROR | [x] Expected 1 space after IF keyword; 0 found
72 | ERROR | [x] Expected 1 space after IF keyword; 0 found
75 | ERROR | [x] Use "elseif" in place of "else if"
75 | ERROR | [x] Expected 1 space after IF keyword; 0 found
89 | ERROR | [x] Expected 1 space after IF keyword; 0 found
90 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
91 | ERROR | [x] Expected 1 space after IF keyword; 0 found
------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------

FILE: ...ml/vb/d_cont/config_track/src/Config/ConfigTrackLanguageConfigOverride.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
7 | ERROR | [x] Missing class doc comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/config_track/config_track.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | Remove "version" from the info file, it will be added by
| | drupal.org packaging automatically
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/config_track/config_track.module
--------------------------------------------------------------------------------
FOUND 21 ERRORS AFFECTING 20 LINES
--------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
15 | ERROR | [x] Trailing punctuation for @see references is not allowed.
18 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
19 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
21 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
22 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
23 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 5
24 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
26 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
27 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
28 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
29 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
38 | ERROR | [x] Trailing punctuation for @see references is not allowed.
47 | ERROR | [ ] The array declaration extends to column 98 (the limit is
| | 80). The array content should be split up over multiple
| | lines
48 | ERROR | [x] Each PHP statement must be on a line by itself
68 | ERROR | [x] Trailing punctuation for @see references is not allowed.
91 | ERROR | [x] Trailing punctuation for @see references is not allowed.
119 | ERROR | [ ] Doc comment short description must be on a single line,
| | further text should be a separate paragraph
169 | ERROR | [ ] Missing parameter type
172 | ERROR | [ ] If there is no return value for a function, there must not
| | be a @return tag.
172 | ERROR | [ ] Description for the @return value is missing
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 16 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 186ms; Memory: 10MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig config_track/

Remaining tasks

Patch review

๐Ÿ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia urvashi_vora Madhya Pradesh, India

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 @urvashi_vora
  • Hello, @urvashi_vora thanks for the patch, I have applied your patch and ran successfully.

    These are the steps I followed:

    1. Took clone from git version 1.0.x in drupal 10.1.x

    2. Ran this command:

    ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,m
    d,yml,twig modules/contrib/config_track/

    3. Applied your patch and, again ran phpcs command

    found errors

    4. I have fixed that error with phpcbf.

    Ran this command to fix the errors:

    ./vendor/bin/phpcbf --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,m
    d,yml,twig modules/contrib/config_track/
    Then again checked with phpcs:

    again ran phpcs command

    ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,m
    d,yml,twig modules/contrib/config_track/

    found no errors.

    Please review.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia aayushDrupal

    aayushmankotia โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia aayushDrupal

    Hi @Satish_kumar

    I have created a patch to address all the PHP coding standard issues. Please review.

  • Status changed to Needs work 10 months ago
  • Hi @aayushmankotia,

    Applied patch #3, some of the files of the patch did not apply successfully, might be the reason the errors below was thrown.

    config_track git:(1.0.x) curl https://www.drupal.org/files/issues/2023-09-05/fixed_issue_3372832-3.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 17682  100 17682    0     0   8751      0  0:00:02  0:00:02 --:--:--  8792
    patching file README.md
    patching file config_track.info.yml
    patching file config_track.install
    patching file config_track.module
    Hunk #2 FAILED at 17.
    Hunk #3 succeeded at 39 (offset -1 lines).
    Hunk #4 succeeded at 48 (offset -1 lines).
    Hunk #5 succeeded at 72 (offset -1 lines).
    Hunk #6 succeeded at 95 (offset -1 lines).
    Hunk #7 succeeded at 122 (offset -1 lines).
    Hunk #8 succeeded at 174 (offset -1 lines).
    1 out of 8 hunks FAILED -- saving rejects to file config_track.module.rej
    patching file src/Config/ConfigTrackLanguageConfigOverride.php
    patching file src/Controller/ConfigTrackController.php
    patching file src/EventSubscriber/ConfigTrackSubscriber.php
    patching file src/Extension/ModuleHandler.php
    โžœ  config_track git:(1.0.x) โœ— cd ..
    โžœ  contrib git:(main) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig config_track
    
    FILE: /Users/PrometInterns/Demo-site/drupal-orgissue/web/modules/contrib/config_track/config_track.module
    ---------------------------------------------------------------------------------------------------------
    FOUND 12 ERRORS AFFECTING 12 LINES
    ---------------------------------------------------------------------------------------------------------
      20 | ERROR | [x] Trailing punctuation for @see references is not allowed.
      23 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
      24 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
      25 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
      26 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
      27 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 5
      28 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
      30 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
      31 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
      32 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
      33 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
     257 | ERROR | [ ] Description for the @return value is missing
    ---------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 11 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------
    
    Time: 448ms; Memory: 12MB

    Kindly check,
    Jake

  • Assigned to priyanka_chauhan31
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia priyanka_chauhan31 Noida

    Hi, I am working on this.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia priyanka_chauhan31 Noida

    Please review the patch. I have solved all the phpcs issues found.

  • First commit to issue fork.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia GGH

    MR Raised

Production build 0.71.5 2024