phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig shows the following errors/warnings that should be fixed.
FILE: ./www_authenticate/www_authenticate.services.yml
----------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------
5 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------
FILE: ./www_authenticate/www_authenticate.info.yml
------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------
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
13 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------
FILE: ./www_authenticate/www_authenticate.permissions.yml
-------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------
3 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------
FILE: ./www_authenticate/config/install/www_authenticate.config.yml
-----------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------
4 | ERROR | [x] Expected 1 newline at end of file; 0 found
-----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------
FILE: ./www_authenticate/src/WwwAuthenticateSubscriber.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 26 ERRORS AND 5 WARNINGS AFFECTING 23 LINES
------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
2 | ERROR | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
10 | WARNING | [x] Unused use statement
18 | ERROR | [ ] Doc comment short description must start with a capital letter
19 | ERROR | [x] There must be exactly one blank line before the tags in a doc comment
19 | ERROR | [ ] The @see reference should not contain any additional text
21 | ERROR | [ ] Parameter tags must be defined first in a doc comment
24 | ERROR | [ ] Public method name "WwwAuthenticateSubscriber::WwwAuthenticateLoad" is not in lowerCamel format
24 | ERROR | [x] Expected 1 blank line before function; 0 found
27 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
41 | ERROR | [x] Expected 1 space before "==="; 3 found
45 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
45 | ERROR | [x] Closing brace indented incorrectly; expected 4 spaces, found 2
45 | ERROR | [x] Expected newline after closing brace
47 | WARNING | [ ] Line exceeds 80 characters; contains 84 characters
48 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
49 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
49 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
51 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
52 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
54 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
56 | WARNING | [ ] Code after the EXIT statement on line 54 cannot be executed
56 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
57 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
58 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
58 | ERROR | [x] Closing brace indented incorrectly; expected 2 spaces, found 0
63 | ERROR | [x] Visibility must be declared on method "getSubscribedEvents"
65 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
66 | ERROR | [x] Short array syntax must be used to define arrays
69 | ERROR | [x] Expected 1 newline at end of file; 0 found
69 | ERROR | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 23 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------
FILE: ./www_authenticate/src/Form/WwwAuthenticateForm.php
--------------------------------------------------------------------------------------------------------
FOUND 11 ERRORS AND 1 WARNING AFFECTING 12 LINES
--------------------------------------------------------------------------------------------------------
3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
12 | WARNING | [x] Unused use statement
39 | ERROR | [x] Short array syntax must be used to define arrays
44 | ERROR | [x] Short array syntax must be used to define arrays
50 | ERROR | [x] Short array syntax must be used to define arrays
56 | ERROR | [x] Short array syntax must be used to define arrays
62 | ERROR | [x] Short array syntax must be used to define arrays
68 | ERROR | [x] Short array syntax must be used to define arrays
89 | ERROR | [x] Expected 1 space after IF keyword; 0 found
90 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
91 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
100 | ERROR | [x] Expected 1 space after IF keyword; 0 found
--------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 12 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------
Time: 46ms; Memory: 10MB
Comments
Comment #2
jayprakash.kushwah commentedComment #3
jayprakash.kushwah commentedComment #4
avpadernoThe issue summary should always describe what the issue is trying to fix and, in the case of coding standards issues, show which command and arguments have been used and which report that command shown.
Comment #5
nitin_lamaComment #6
nitin_lamaThe provided patch doesn't apply. Providing an updated patch.
Comment #7
nitin_lamaComment #8
nitin_lamaComment #9
avpadernoComment #10
avpadernoWhen I run the reported command, I get more errors/warnings.
Comment #11
avpadernoComment #12
mrinalini9 commentedRerolled patch #6, please review it.
Thanks!
Comment #13
avpadernoThe sentence in the comment is an example of comma-splice sentence, which is grammatically not correct. Instead of the comma, the correct punctuation mark is either the semicolon or the period.
Only if KernelEvents::REQUEST !!! is not necessary, since that is clear from the used code.
The
@seeline must be after the@paramline. The correct order is the following one.Periods are not added at the end of commented out code. That commented out line is not even necessary, like the comment before it.
Comment #14
imustakim commentedComment #15
imustakim commentedPatch updated.
Please review.
Comment #16
sujan shresthaComment #17
sujan shrestha