Drupal Coding Standards Issues | phpcs

Created on 24 January 2023, almost 2 years ago
Updated 29 January 2024, 11 months ago

Problem/Motivation

Getting following error/warnings

FILE: C:\xampp\htdocs\abc\drupal\modules\resume_submit\resume.module
----------------------------------------------------------------------
FOUND 15 ERRORS AND 1 WARNING AFFECTING 14 LINES
----------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one
| | blank line
1 | ERROR | [x] End of line character is invalid; expected "\n"
| | but found "\r\n"
2 | ERROR | [x] You must use "/**" style comments for a file
| | comment
5 | ERROR | [x] Line indented incorrectly; expected 1 spaces,
| | found 0
9 | WARNING | [ ] Format should be "* Implements hook_foo().", "*
| | Implements hook_foo_BAR_ID_bar() for
| | xyz_bar().",, "* Implements hook_foo_BAR_ID_bar()
| | for xyz-bar.html.twig.", "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or
| | "* Implements hook_foo_BAR_ID_bar() for block
| | templates."
11 | ERROR | [x] Line indented incorrectly; expected 0 spaces,
| | found 1
12 | ERROR | [x] Line indented incorrectly; expected 2 spaces,
| | found 3
13 | ERROR | [x] Line indented incorrectly; expected 4 spaces,
| | found 5
14 | ERROR | [x] Line indented incorrectly; expected 6 spaces,
| | found 7
15 | ERROR | [x] Line indented incorrectly; expected 6 spaces,
| | found 7
16 | ERROR | [x] Line indented incorrectly; expected 6 spaces,
| | found 7
18 | ERROR | [x] Whitespace found at end of line
19 | ERROR | [x] Line indented incorrectly; expected 4 spaces,
| | found 5
20 | ERROR | [x] Line indented incorrectly; expected 2 spaces,
| | found 3
21 | ERROR | [x] Expected 1 newline at end of file; 2 found
21 | ERROR | [x] Line indented incorrectly; expected 0 spaces,
| | found 1
----------------------------------------------------------------------
PHPCBF CAN FIX THE 15 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...xampp\htdocs\abc\drupal\modules\resume_submit\resume.routing.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
15 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...\htdocs\abc\drupal\modules\resume_submit\src\Form\ResumeForm.php
----------------------------------------------------------------------
FOUND 36 ERRORS AND 13 WARNINGS AFFECTING 34 LINES
----------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one
| | blank line
1 | ERROR | [x] End of line character is invalid; expected "\n"
| | but found "\r\n"
2 | ERROR | [x] Namespaced classes, interfaces and traits should
| | not begin with a file doc comment
3 | ERROR | [x] Doc comment star missing
4 | ERROR | [x] Doc comment star missing
5 | ERROR | [ ] Doc comment short description must end with a
| | full stop
5 | ERROR | [ ] Doc comment short description must be on a
| | single line, further text should be a separate
| | paragraph
11 | ERROR | [x] Missing class doc comment
15 | ERROR | [x] Expected 1 blank line before function; 0 found
24 | ERROR | [x] Short array syntax must be used to define arrays
26 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
30 | ERROR | [x] Short array syntax must be used to define arrays
32 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
36 | ERROR | [x] Short array syntax must be used to define arrays
36 | ERROR | [x] There must be no space between the "array"
| | keyword and the opening parenthesis
38 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
41 | ERROR | [x] Short array syntax must be used to define arrays
41 | ERROR | [x] There must be no space between the "array"
| | keyword and the opening parenthesis
43 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
47 | ERROR | [x] Short array syntax must be used to define arrays
47 | ERROR | [x] There must be no space between the "array"
| | keyword and the opening parenthesis
50 | ERROR | [x] Short array syntax must be used to define arrays
51 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
52 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
56 | ERROR | [x] Short array syntax must be used to define arrays
56 | ERROR | [x] There must be no space between the "array"
| | keyword and the opening parenthesis
59 | ERROR | [x] Short array syntax must be used to define arrays
60 | ERROR | [x] Expected 1 space after "=>"; 0 found
60 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
61 | ERROR | [x] Expected 1 space after "=>"; 0 found
61 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
61 | WARNING | [x] A comma should follow the last multiline array
| | item. Found: )
65 | ERROR | [x] Short array syntax must be used to define arrays
67 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
71 | ERROR | [x] Short array syntax must be used to define arrays
82 | ERROR | [x] Line indented incorrectly; expected 2 spaces,
| | found 4
84 | ERROR | [x] Line indented incorrectly; expected 4 spaces,
| | found 6
85 | ERROR | [x] Line indented incorrectly; expected 6 spaces,
| | found 8
86 | ERROR | [x] Line indented incorrectly; expected 4 spaces,
| | found 6
88 | ERROR | [x] Line indented incorrectly; expected 2 spaces,
| | found 4
95 | WARNING | [ ] Line exceeds 80 characters; contains 149
| | characters
95 | WARNING | [x] There must be no blank line following an inline
| | comment
95 | WARNING | [ ] There must be no blank line following an inline
| | comment
95 | ERROR | [x] Line indented incorrectly; expected 4 spaces,
| | found 3
95 | ERROR | [x] Inline comments must end in full-stops,
| | exclamation marks, question marks, colons, or
| | closing parentheses
101 | ERROR | [x] Line indented incorrectly; expected 2 spaces,
| | found 3
101 | ERROR | [x] Closing brace indented incorrectly; expected 2
| | spaces, found 3
102 | ERROR | [x] Expected 1 newline at end of file; 0 found
102 | ERROR | [x] The closing brace for the class must have an
| | empty line before it
----------------------------------------------------------------------
PHPCBF CAN FIX THE 36 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...pp\htdocs\abc\drupal\modules\resume_submit\src\Form\WorkForm.php
----------------------------------------------------------------------
FOUND 17 ERRORS AND 2 WARNINGS AFFECTING 14 LINES
----------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one
| | blank line
1 | ERROR | [x] End of line character is invalid; expected "\n"
| | but found "\r\n"
2 | ERROR | [x] Namespaced classes, interfaces and traits should
| | not begin with a file doc comment
3 | ERROR | [x] Doc comment star missing
4 | ERROR | [x] Doc comment star missing
5 | ERROR | [ ] Doc comment short description must end with a
| | full stop
5 | ERROR | [ ] Doc comment short description must be on a single
| | line, further text should be a separate paragraph
11 | ERROR | [ ] Class name doesn't match filename; expected
| | "class WorkForm"
11 | ERROR | [x] Missing class doc comment
11 | ERROR | [ ] Class name must begin with a capital letter
15 | ERROR | [x] Expected 1 blank line before function; 0 found
24 | ERROR | [x] Short array syntax must be used to define arrays
26 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
30 | ERROR | [x] Short array syntax must be used to define arrays
32 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
37 | ERROR | [x] Short array syntax must be used to define arrays
50 | ERROR | [x] Short array syntax must be used to define arrays
53 | ERROR | [x] Expected 1 newline at end of file; 0 found
53 | ERROR | [x] The closing brace for the class must have an
| | empty line before it
----------------------------------------------------------------------
PHPCBF CAN FIX THE 13 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India Charchil Khandelwal

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024