When running the module code against Drupal coding standards based on Drupal standard, the module shows errors
phpcs -s --standard=Drupal sites/default/modules/like_and_dislike/
FILE: .../default/modules/like_and_dislike/src/LikeDislikePermissions.php
----------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------
3 | ERROR | [x] Namespaced classes, interfaces and traits should not
| | begin with a file doc comment
| | (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
30 | ERROR | [x] Separate the @return and @see sections by a blank
| | line. (Drupal.Commenting.DocComment.TagGroupSpacing)
58 | ERROR | [ ] Expected type hint "VoteType"; found
| | "ConfigEntityInterface" for $type
| | (Drupal.Commenting.FunctionComment.IncorrectTypeHint)
79 | ERROR | [x] Missing function doc comment
| | (Drupal.Commenting.FunctionComment.Missing)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...sites/default/modules/like_and_dislike/src/Form/SettingsForm.php
----------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------
3 | ERROR | [x] Namespaced classes, interfaces and traits should not
| | begin with a file doc comment
| | (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
6 | ERROR | [ ] Doc comment short description must be on a single
| | line, further text should be a separate paragraph
| | (Drupal.Commenting.DocComment.ShortSingleLine)
106 | ERROR | [x] Expected 1 newline at end of file; 0 found
| | (Drupal.Files.EndFileNewline.NoneFound)
106 | ERROR | [x] The closing brace for the class must have an empty
| | line before it
| | (Drupal.Classes.ClassDeclaration.CloseBraceAfterBody)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...ult/modules/like_and_dislike/src/LikeDislikeAccessController.php
----------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------
8 | ERROR | [x] Missing class doc comment
| | (Drupal.Commenting.ClassComment.Missing)
10 | ERROR | [x] Missing function doc comment
| | (Drupal.Commenting.FunctionComment.Missing)
13 | ERROR | [x] Expected 1 newline at end of file; 0 found
| | (Drupal.Files.EndFileNewline.NoneFound)
13 | ERROR | [x] The closing brace for the class must have an empty line
| | before it
| | (Drupal.Classes.ClassDeclaration.CloseBraceAfterBody)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...fault/modules/like_and_dislike/src/Controller/VoteController.php
----------------------------------------------------------------------
FOUND 5 ERRORS AND 1 WARNING AFFECTING 5 LINES
----------------------------------------------------------------------
3 | ERROR | [x] Namespaced classes, interfaces and traits should not
| | begin with a file doc comment
| | (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
27 | ERROR | [ ] Visibility must be declared on method "vote"
| | (Squiz.Scope.MethodScope.Missing)
47 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: $vote_type_id
| | (Drupal.Array.Array.CommaLastItem)
53 | ERROR | [x] Space found before comma in function call
| | (Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma)
59 | ERROR | [x] Expected 1 newline at end of file; 0 found
| | (Drupal.Files.EndFileNewline.NoneFound)
59 | ERROR | [x] The closing brace for the class must have an empty
| | line before it
| | (Drupal.Classes.ClassDeclaration.CloseBraceAfterBody)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
Time: 100ms; Memory: 6Mb
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | interdiff-2732401-10-14.txt | 491 bytes | shruti1803 |
| #14 | fix_coding_standard-2732401-14.patch | 3.02 KB | shruti1803 |
| #11 | interdiff.txt | 1.63 KB | amit.drupal |
| #11 | fix_coding_standard-2732401-10.patch | 2.89 KB | amit.drupal |
| #10 | fix_coding_standard-2732401-9.patch | 1.35 KB | mbovan |
Comments
Comment #2
anoopjohn commentedPlease find attached a patch that fixes the issues reported.
Comment #3
mbovan commentedThe patch #2 doesn't apply anymore. @anoopjohn, could you please reroll it?
Comment #4
mbovan commentedQuickly rebased with 8.x-1.x.
I think there are more changes to make here, but we could do it when touching the files in other issues.
Comment #5
berdirAlready doesn't apply anymore. Lets finish the current refactoring phase and then get back to this.
Comment #6
berdirComment #9
mbovan commentedLots of changes in the previous patches are either removed or already fixed.
Here is a quick update.
However, there are many deprecated methods, documentation and other code style fixes that we can work on...
Comment #10
mbovan commentedForgot the patch.
Comment #11
amit.drupal commentedComment #12
berdirwhat is a Dislikoe? :)
Comment #13
shruti1803 commentedComment #14
shruti1803 commentedAdding patch as mentioned concern in #12.
Comment #15
shruti1803 commentedComment #16
berdirThanks everyone. Time for a new release.
Comment #18
mbovan commented