Running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml shows the following warnings/errors, which should be fixed.
FILE: ./README.txt
----------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
----------------------------------------------------------------------
41 | WARNING | [ ] Line exceeds 80 characters; contains 98
| | characters
50 | WARNING | [ ] Line exceeds 80 characters; contains 81
| | characters
55 | ERROR | [x] Expected 1 newline at end of file; 2 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ./registration_invite.info.yml
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
1 | WARNING | "core_version_requirement" property is missing in the
| | info.yml file
7 | WARNING | All dependencies must be prefixed with the project
| | name, for example "drupal:"
----------------------------------------------------------------------
FILE: ./registration_invite.module
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
9 | ERROR | [x] Use statements should be sorted alphabetically. The
| | first wrong one is
| | Drupal\Core\Form\FormStateInterface.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ./registration_invite.routing.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
6 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ./registration_invite.services.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
6 | ERROR | [x] Expected 1 newline at end of file; 3 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ./src/Controller/RegisterRedirect.php
----------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
----------------------------------------------------------------------
9 | WARNING | [ ] The class short comment should describe what the
| | class does and not simply repeat the class name
16 | ERROR | [x] Short array syntax must be used to define arrays
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ./src/EventSubscriber/RegisterSubscriber.php
----------------------------------------------------------------------
FOUND 1 ERROR AND 4 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------
6 | WARNING | [x] Unused use statement
6 | ERROR | [x] Use statements should be sorted alphabetically.
| | The first wrong one is
| | Symfony\Component\EventDispatcher\Event.
13 | WARNING | [ ] The class short comment should describe what the
| | class does and not simply repeat the class name
21 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
24 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
Time: 131ms; Memory: 6MB
Comments
Comment #2
emartoni commentedPatch attached!
Best,
Eduardo
Comment #3
emartoni commentedComment #4
socialnicheguru commentedgit apply phpcs_2958038-2.patch
error: patch failed: registration_invite.info.yml:4
error: registration_invite.info.yml: patch does not apply
modules/contrib/registration_invite$ patch -p1 < phpcs_2958038-2.patch
patching file README.txt
patching file registration_invite.info.yml
Hunk #1 FAILED at 4.
1 out of 1 hunk FAILED -- saving rejects to file registration_invite.info.yml.rej
patching file registration_invite.routing.yml
patching file registration_invite.services.yml
patching file src/Controller/RegisterRedirect.php
patching file src/EventSubscriber/RegisterSubscriber.php
/modules/contrib/registration_invite$ more registration_invite.info.yml.rej
--- registration_invite.info.yml
+++ registration_invite.info.yml
@@ -4,4 +4,4 @@ description: 'User registration by invitation only'
core: 8.x
package: 'Custom'
dependencies:
- - invite
+ - drupal:invite
Comment #5
neeraprajapati commentedApplied patch for fixing phpcs error.
Comment #6
urvashi_vora commentedHi,
I will review this.
Comment #7
urvashi_vora commentedHi,
Your patch didn't work, and it got failed.
Thanks
Comment #8
suresh prabhu parkala commentedA re-rolled patch against the latest 8.x-1.x. Please review.
Comment #9
dharti patel commentedI'll review #8 patch.
Comment #10
dharti patel commentedI've reviewed the patch but after applying the patch facing the below errors.
I'm working on this issue and creating a patch for the same.
Comment #11
dharti patel commentedHello,
I have created a patch to fix this issue.
Kindly review the patch.
Thanks!
Comment #12
erikaagp commentedComment #13
avpadernoThe issue summary should always describe what the issue is trying to fix and, in the case, of coding standards issues, show which command has been used, which arguments have been used, and which report that command shown.
There is no need to add
core_version_requirement: ^8.Comment #14
akram khanadded updated patch it fixed all phpcs issues and address #13
Comment #15
avpadernoThe status is for the issue summary, which is yet to be updated.
Comment #16
sahil.goyal commentedPatch #14 works alright, patch applies cleanly, and after applying the patch all php coding standard issues and warnings got fixed.
Moving to RTBC
Attaching Screenshot that patch applies cleanly and no errors and warning left.
updated the issue summery, Addressed the #15
Thanks.
Comment #17
avpadernoThat comment is still just saying the class name. Adding a preposition does not make any difference; it still does not describe the class purpose.
The phrase need an article. Factory does not need to be capitalized, since it is not at the beginning of the sentence.
The same is true for this description, in this case for User.
The class name does not include the namespace. Descriptions for methods, like the descriptions for functions, start with a verb that uses the present tense and the third person singular.
If that is described as service, then it is the account proxy service.
Comment #18
rassoni commentedAddressed #17 feedbacks. Please review
Comment #19
avpadernoThe existing line is already correctly formatted, contrarily to the changed line, which removes a space where it should not be removed.
What follows to is usually a verb, not a noun.
That doesn't fix what reported in the previous comment, neither for the namespace nor for the service description.
Comment #20
imustakim commentedWorking on this.
Comment #21
imustakim commentedPatch updated.
Please review.
Comment #22
avpadernoThe existing line is already correct, since that is what the user profile shows.
It should be to show a message on redirect, since it does not register messages nor message handlers.
The namespace is missing.
Comment #23
imustakim commentedWorking on this.
Comment #24
imustakim commentedThis line exceeds 80 character and gives error in phpcs. Its only one space that is causing the issue.
Adding namespace also exceeds the 80 character and gives error in phpcs.
Added changes and updated the patch.
Please review.
Comment #25
imustakim commentedComment #26
avpadernoYet, the name shown in the user profile is Karthik Kumar D K, not Karthik Kumar DK. Just ignore that error, or find another way to fix it.
For example, (heykarthikwithu) is not strictly necessary, since that part is already visible in the user profile link. The format used to show the maintainers is just suggested; it is not mandatory, since the Drupal coding standards do not say the format to use for those links.
Between showing the class namespace and having a line that is shorted than 81 characters, it is more important to show the class namespace. To short the sentence is sufficient to avoid new and use object instead of instance.
Comment #27
imustakim commentedWorking on this.
Comment #28
imustakim commentedPatch updated.
Please review.
Comment #29
imustakim commentedComment #30
avpadernoThe name reported in the user profile is Karthik Kumar D K, not Karthik Kumar DK.
core_version_requirementis not recognized by any Drupal version that is lower than 8.8. Eithercoreis left, or the core requirement is changed.The Invite module is not a Drupal core module.
That class is not a controller.
The short description for a class constructor starts with Constructs a new.
Comment #31
mrinalini9 commentedUpdated patch #28 by addressing #30, please review it.
Thanks!
Comment #32
arpitk commentedHi @mrinalini9 I reviewed the patch #31 Applies cleanly on version
8.x-1.x-dev. The changes from #30 also has been taken care. Only the error produced but phpcs as follows:
C:\xampp\htdocs\d8\web\modules\contrib\registration_invite> phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml .
FILE: ...modules\contrib\registration_invite\registration_invite.info.yml
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
1 | WARNING | "core_version_requirement" property is missing in the
| | info.yml file
----------------------------------------------------------------------
As mention in #30 regarding core_version_requirement. This remains.
Thanks!
Comment #33
avpadernocore: 8.xI should have been clear about that. The core requirements should one of the following.
The latter is not equivalent to the first, as the first includes Drupal versions like Drupal 8.1, which are excluded from the latter.
The class namespace is missing.
Comment #34
sourabhjainLet me work on it.
Comment #35
sourabhjainFixed the issue mentioned in #33. Please review.
Comment #36
nisha_j commentedHi, patch #35 failed to apply.
Thankyou.
Comment #37
avpaderno