Problem/Motivation
Fix the coding standard issues for 2.0.x branch
Steps to reproduce
Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig addtoany/
Remaining tasks
Fix all the issues:
FILE: ...tml/contribution/drupal8/web/modules/contrib/addtoany/js/addtoany.admin.js
--------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------
5 | ERROR | [x] Functions must not contain multiple empty lines in a row;
| | found 2 empty lines
14 | ERROR | [x] Functions must not contain multiple empty lines in a row;
| | found 2 empty lines
28 | ERROR | [x] Functions must not contain multiple empty lines in a row;
| | found 2 empty lines
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...www/html/contribution/drupal8/web/modules/contrib/addtoany/addtoany.module
--------------------------------------------------------------------------------
FOUND 22 ERRORS AND 3 WARNINGS AFFECTING 19 LINES
--------------------------------------------------------------------------------
18 | ERROR | [x] Function comment short description must start with exactly
| | one space
20 | ERROR | [x] Expected 1 space before opening brace; found 0
21 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
22 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
23 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
24 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
25 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
27 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
28 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
29 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
29 | WARNING | [ ] Avoid backslash escaping in translatable strings when
| | possible, use "" quotes instead
30 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
31 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
32 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
32 | WARNING | [ ] Translatable strings must not begin or end with white
| | spaces, use placeholders with t() for variables
32 | WARNING | [ ] Avoid backslash escaping in translatable strings when
| | possible, use "" quotes instead
32 | ERROR | [x] Concat operator must be surrounded by a single space
33 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
34 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
35 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
37 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
38 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 1
38 | ERROR | [x] Closing brace indented incorrectly; expected 0 spaces,
| | found 1
38 | ERROR | [x] Expected 1 blank line after function; 2 found
193 | ERROR | [ ] String concat is not required here; use a single string
| | instead
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 21 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...on/drupal8/web/modules/contrib/addtoany/src/Plugin/Block/AddToAnyBlock.php
--------------------------------------------------------------------------------
FOUND 6 ERRORS AND 3 WARNINGS AFFECTING 8 LINES
--------------------------------------------------------------------------------
22 | ERROR | [ ] Missing @var tag in member variable comment
23 | ERROR | [ ] Class property $addtoany_option_keys should use lowerCamel
| | naming without underscores
35 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
37 | WARNING | [ ] Node::load calls should be avoided in classes, use
| | dependency injection instead
40 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but
| | found "true"
40 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE"
| | but found "false"
63 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
88 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 9
89 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 9
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: .../web/modules/contrib/addtoany/src/Plugin/views/field/NodeAddToAnyShare.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
17 | ERROR | Missing short description in doc comment
24 | ERROR | Missing short description in doc comment
--------------------------------------------------------------------------------
FILE: ...ion/drupal8/web/modules/contrib/addtoany/src/Form/AddToAnySettingsForm.php
--------------------------------------------------------------------------------
FOUND 7 ERRORS AND 7 WARNINGS AFFECTING 12 LINES
--------------------------------------------------------------------------------
8 | WARNING | [x] Unused use statement
52 | ERROR | [x] Parameter comment indentation must be 3 spaces, found 2
| | spaces
238 | WARNING | [ ] Line exceeds 80 characters; contains 86 characters
251 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
261 | WARNING | [ ] Line exceeds 80 characters; contains 98 characters
263 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
263 | WARNING | [ ] Only string literals should be passed to t() where
| | possible
277 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: ]
304 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
317 | ERROR | [x] There must be exactly one blank line before the tags in a
| | doc comment
317 | ERROR | [ ] Description for the @return value is missing
322 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
330 | ERROR | [x] Expected 1 blank line after function; 0 found
331 | ERROR | [x] The closing brace for the class must have an empty line
| | before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...ww/html/contribution/drupal8/web/modules/contrib/addtoany/addtoany.api.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
14 | ERROR | Type hint "array" missing for $types
--------------------------------------------------------------------------------
Time: 1.19 secs; Memory: 12MB
Issue fork addtoany-3350785
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3350785-fix-issues-reported
changes, plain diff MR !10
- 3350785-phpcs
changes, plain diff MR !11
Comments
Comment #3
urvashi_vora commentedComment #4
avpadernoComment #5
avpadernoThe short description for a class constructor needs to include the class name and its namespace.
The storage handler class for nodes. can be shortened to The node storage handler class.
Comment #6
urvashi_vora commentedComment #7
avpadernoIt should describe what is returned, not the value's type, since that is already clear from the previous line.
The class namespace is missing.
Since that line is changed, then it should be also shortened.
isset($node) && $node instanceof NodeInterfacealready returns a Boolean value.Comment #10
kunalgautam commentedComment #12
vladimirausLooks good!
Applying to the latest branches.
Comment #16
vladimirausAll committed. Cheers 🍻