Fix the issues reported by phpcs

Created on 26 February 2024, 4 months ago
Updated 4 March 2024, 4 months ago

Steps to reproduce

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

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

FILE: D:\xampp\htdocs\drupal9\web\modules\contrib\custom_css_class_to_body\custom_css_class_to_body.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: D:\xampp\htdocs\drupal9\web\modules\contrib\custom_css_class_to_body\custom_css_class_to_body.module
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AFFECTING 8 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
3 | ERROR | [ ] Doc comment is empty
4 | ERROR | [x] The second line in the file doc comment must be "@file"
9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\node\NodeInterface.
114 | ERROR | [x] Hook implementations must be documented with "Implements hook_example()."
116 | ERROR | [ ] All functions defined in a module file must be prefixed with the module's name, found "_node_special_character_form_validate" but expected
| | "custom_css_class_to_body__node_special_character_form_validate"
132 | ERROR | [x] Concat operator must be surrounded by a single space
132 | ERROR | [x] Concat operator must be surrounded by a single space
133 | ERROR | [x] Concat operator must be surrounded by a single space
133 | ERROR | [x] Concat operator must be surrounded by a single space
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal9\web\modules\contrib\custom_css_class_to_body\README.md
------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------
29 | WARNING | Line exceeds 80 characters; contains 95 characters
42 | WARNING | Line exceeds 80 characters; contains 82 characters

๐Ÿ“Œ 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
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Mithun S Bangalore

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

  • Status changed to Needs review 4 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Mithun S Bangalore

    Fixed the Phpcs issues for the module and raised an MR to the branch 1.0.x
    Changing the status of issue to Needs review.

  • Status changed to Needs work 4 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines paraderojether

    Hi Mithun S,

    I reviewed MR!3, the MR is not applied cleanly and there are still remaining warnings shown below:

    jetherparadero@PrometSources-MacBook-Pro custom_css_class_to_body % curl https://git.drupalcode.org/project/custom_css_class_to_body/-/merge_requests/3.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  4309    0  4309    0     0   1701      0 --:--:--  0:00:02 --:--:--  1705
    patching file README.md
    patching file custom_css_class_to_body.info.yml
    1 out of 1 hunks failed--saving rejects to custom_css_class_to_body.info.yml.rej
    patching file custom_css_class_to_body.module
    jetherparadero@PrometSources-MacBook-Pro custom_css_class_to_body % cd ..
    jetherparadero@PrometSources-MacBook-Pro contrib % phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml custom_css_class_to_body
    
    FILE: /Users/jetherparadero/d_o/drupal-issues/web/modules/contrib/custom_css_class_to_body/custom_css_class_to_body.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
    ----------------------------------------------------------------------------------------------------------------------------
    
    Time: 106ms; Memory: 10MB

    Kindly check and advise.
    Thank you.

Production build 0.69.0 2024