Fix the issues reported by phpcs

Created on 5 March 2024, 9 months ago
Updated 10 July 2024, 4 months ago

Steps to reproduce

When I run the reported command, I get more errors/warnings.

This is the commend
phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml

FILE: C:\xampp\htdocs\newdrupal\web\modules\contrib\smart_content_lytics\README.md
----------------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------------------
4 | WARNING | [ ] Line exceeds 80 characters; contains 261 characters
9 | WARNING | [ ] Line exceeds 80 characters; contains 100 characters
24 | WARNING | [ ] Line exceeds 80 characters; contains 186 characters
28 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\newdrupal\web\modules\contrib\smart_content_lytics\smart_content_lytics.info.yml
-----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "project" 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: C:\xampp\htdocs\newdrupal\web\modules\contrib\smart_content_lytics\smart_content_lytics.module
----------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
9 | ERROR | [x] Opening brace should be on the same line as the declaration
11 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\newdrupal\web\modules\contrib\smart_content_lytics\src\Plugin\Derivative\LyticsConditionDeriver.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 9 ERRORS AND 1 WARNING AFFECTING 10 LINES
-------------------------------------------------------------------------------------------------------------------------
17 | ERROR | [x] Opening brace should be on the same line as the declaration
41 | ERROR | [x] Opening brace should be on the same line as the declaration
50 | ERROR | [x] Opening brace should be on the same line as the declaration
58 | ERROR | [x] You must use "/**" style comments for a function comment
59 | ERROR | [x] Opening brace should be on the same line as the declaration
67 | ERROR | [x] Opening brace should be on the same line as the declaration
85 | ERROR | [x] Opening brace should be on the same line as the declaration
99 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
131 | ERROR | [x] Opening brace should be on the same line as the declaration
151 | ERROR | [x] Expected 1 blank line after function; 0 found
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\newdrupal\web\modules\contrib\smart_content_lytics\src\Plugin\smart_content\Condition\Group\Lytics.php
----------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
17 | ERROR | [x] Opening brace should be on the same line as the declaration
----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\newdrupal\web\modules\contrib\smart_content_lytics\src\Plugin\smart_content\Condition\LyticsCondition.php
-------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------------------------------------
18 | ERROR | [x] Opening brace should be on the same line as the declaration
24 | ERROR | [x] Opening brace should be on the same line as the declaration
27 | ERROR | [x] Expected 1 blank line after function; 0 found
-------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------

šŸ“Œ Task
Status

Needs work

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India jayprakash.kushwah 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 @jayprakash.kushwah
  • First commit to issue fork.
  • Assigned to nitin_lama
  • šŸ‡®šŸ‡³India nitin_lama India
  • Merge request !1#3425723: MR for the changes ā†’ (Open) created by nitin_lama
  • šŸ‡®šŸ‡³India nitin_lama India

    Please review. Thanks.

  • Issue was unassigned.
  • Status changed to Needs review 8 months ago
  • šŸ‡®šŸ‡³India nitin_lama India
  • First commit to issue fork.
  • šŸ‡®šŸ‡³India Yashaswi18

    On running the command phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml smart_content_lytics/ found these errors remaining:

    FILE: /home/yashaswi/contribs/smart_content_lytics/smart_content_lytics.info.yml
    -----------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------
     1 | WARNING | Remove "project" 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/yashaswi/contribs/smart_content_lytics/src/Plugin/Derivative/LyticsConditionDeriver.php
    ---------------------------------------------------------------------------------------------------
    FOUND 9 ERRORS AND 1 WARNING AFFECTING 10 LINES
    ---------------------------------------------------------------------------------------------------
      17 | ERROR   | [x] Opening brace should be on the same line as the declaration
      41 | ERROR   | [x] Opening brace should be on the same line as the declaration
      50 | ERROR   | [x] Opening brace should be on the same line as the declaration
      58 | ERROR   | [x] You must use "/**" style comments for a function comment
      59 | ERROR   | [x] Opening brace should be on the same line as the declaration
      67 | ERROR   | [x] Opening brace should be on the same line as the declaration
      85 | ERROR   | [x] Opening brace should be on the same line as the declaration
      99 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
     131 | ERROR   | [x] Opening brace should be on the same line as the declaration
     151 | ERROR   | [x] Expected 1 blank line after function; 0 found
    ---------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------
    
    
    FILE: /home/yashaswi/contribs/smart_content_lytics/src/Plugin/smart_content/Condition/LyticsCondition.php
    ---------------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    ---------------------------------------------------------------------------------------------------------
     18 | ERROR | [x] Opening brace should be on the same line as the declaration
     24 | ERROR | [x] Opening brace should be on the same line as the declaration
     27 | ERROR | [x] Expected 1 blank line after function; 0 found
    ---------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/yashaswi/contribs/smart_content_lytics/src/Plugin/smart_content/Condition/Group/Lytics.php
    ------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    ------------------------------------------------------------------------------------------------------
      1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
     17 | ERROR | [x] Opening brace should be on the same line as the declaration
    ------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/yashaswi/contribs/smart_content_lytics/README.md
    ------------------------------------------------------------------------
    FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
    ------------------------------------------------------------------------
      4 | WARNING | [ ] Line exceeds 80 characters; contains 261 characters
      9 | WARNING | [ ] Line exceeds 80 characters; contains 100 characters
     24 | WARNING | [ ] Line exceeds 80 characters; contains 186 characters
     28 | ERROR   | [x] Expected 1 newline at end of file; 0 found
    ------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------
    
    
    FILE: /home/yashaswi/contribs/smart_content_lytics/smart_content_lytics.module
    ------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    ------------------------------------------------------------------------------
      1 | ERROR | [x] Missing file doc comment
      9 | ERROR | [x] Opening brace should be on the same line as the declaration
     11 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
    ------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------
  • Assigned to nitin_lama
  • šŸ‡®šŸ‡³India nitin_lama India
  • šŸ‡®šŸ‡³India nitin_lama India

    I don't see any remaining issues on 1.0.x branch. Please review.

  • Issue was unassigned.
  • šŸ‡®šŸ‡³India nitin_lama India
  • Status changed to Needs work 4 months ago
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi @nitin_lama,

    I applied MR!1, it was not applied smoothly and I still encounter some errors after I ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml.

    āžœ  smart_content_lytics git:(main) āœ— curl https://git.drupalcode.org/project/smart_content_lytics/-/merge_requests/1.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  8897    0  8897    0     0  19541      0 --:--:-- --:--:-- --:--:-- 19553
    patching file README.md
    Hunk #1 succeeded at 1 with fuzz 2.
    Hunk #2 FAILED at 25.
    1 out of 2 hunks FAILED -- saving rejects to file README.md.rej
    patching file smart_content_lytics.info.yml
    Hunk #1 FAILED at 6.
    1 out of 1 hunk FAILED -- saving rejects to file smart_content_lytics.info.yml.rej
    patching file smart_content_lytics.module
    patching file src/Plugin/Derivative/LyticsConditionDeriver.php
    Hunk #3 succeeded at 44 with fuzz 1.
    Hunk #4 succeeded at 77 (offset -1 lines).
    Hunk #5 succeeded at 91 (offset -1 lines).
    Hunk #6 succeeded at 123 (offset -1 lines).
    Hunk #7 succeeded at 144 with fuzz 2 (offset -1 lines).
    patching file src/Plugin/smart_content/Condition/Group/Lytics.php
    patching file src/Plugin/smart_content/Condition/LyticsCondition.php
    āžœ  smart_content_lytics git:(main) āœ— ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml smart_content_lytics
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/smart_content_lytics/smart_content_lytics.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: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/smart_content_lytics/README.md
    ---------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    ---------------------------------------------------------------------------------------------------
     16 | WARNING | Line exceeds 80 characters; contains 150 characters
     34 | WARNING | Line exceeds 80 characters; contains 186 characters
    ---------------------------------------------------------------------------------------------------
    
    Time: 124ms; Memory: 10MB
    
    āžœ  contrib git:(main) āœ—

    Thank you.

Production build 0.71.5 2024