FILE: C:\xampp_new\htdocs\contribute\web\modules\custom\umami_analytics\src\Form\SettingsForm.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 17 WARNINGS AFFECTING 20 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
19 | ERROR | [x] Data types in @var tags need to be fully namespaced
28 | ERROR | [ ] Doc comment for parameter $current_user does not match actual variable name $umami_analytics_javascript
162 | ERROR | [ ] The array declaration extends to column 316 (the limit is 80). The array content should be split up over multiple lines
192 | WARNING | [x] There must be no blank line following an inline comment
192 | WARNING | [x] '@TODO' should match the format '@todo Fix problem X here.'
195 | WARNING | [ ] Code after the RETURN statement on line 190 cannot be executed
196 | WARNING | [ ] Code after the RETURN statement on line 190 cannot be executed
197 | WARNING | [ ] Code after the RETURN statement on line 190 cannot be executed
198 | WARNING | [ ] Code after the RETURN statement on line 190 cannot be executed
199 | WARNING | [ ] Code after the RETURN statement on line 190 cannot be executed
201 | WARNING | [ ] Code after the RETURN statement on line 190 cannot be executed
202 | WARNING | [ ] Code after the RETURN statement on line 190 cannot be executed
203 | WARNING | [ ] Code after the RETURN statement on line 190 cannot be executed
204 | WARNING | [ ] Code after the RETURN statement on line 190 cannot be executed
205 | WARNING | [ ] Code after the RETURN statement on line 190 cannot be executed
206 | WARNING | [ ] Code after the RETURN statement on line 190 cannot be executed
208 | WARNING | [ ] Code after the RETURN statement on line 190 cannot be executed
242 | WARNING | [x] '@TODO.' should match the format '@todo Fix problem X here.'
246 | WARNING | [ ] Code after the RETURN statement on line 243 cannot be executed
247 | WARNING | [ ] Code after the RETURN statement on line 243 cannot be executed
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp_new\htdocs\contribute\web\modules\custom\umami_analytics\src\Helpers\VisiblityTracker.php
--------------------------------------------------------------------------------------------------------
FOUND 8 ERRORS AND 1 WARNING AFFECTING 9 LINES
--------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
15 | ERROR | [ ] Missing short description in doc comment
20 | ERROR | [ ] Missing short description in doc comment
25 | ERROR | [ ] Missing short description in doc comment
30 | ERROR | [ ] Missing short description in doc comment
35 | ERROR | [ ] Parameter $current_path is not described in comment
81 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
127 | ERROR | [x] Expected 1 blank line after function; 0 found
128 | ERROR | [x] The closing brace for the class must have an empty line before it
--------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------

FILE: C:\xampp_new\htdocs\contribute\web\modules\custom\umami_analytics\src\JavascriptLocalCache.php
----------------------------------------------------------------------------------------------------
FOUND 9 ERRORS AFFECTING 9 LINES
----------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
13 | ERROR | [x] Missing class doc comment
15 | ERROR | [ ] Missing short description in doc comment
20 | ERROR | [ ] Missing short description in doc comment
25 | ERROR | [ ] Missing short description in doc comment
30 | ERROR | [ ] Missing short description in doc comment
35 | ERROR | [ ] Missing short description in doc comment
40 | ERROR | [x] Missing function doc comment
46 | ERROR | [x] Expected 1 blank line after function; 0 found
----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------

FILE: C:\xampp_new\htdocs\contribute\web\modules\custom\umami_analytics\umami_analytics.module
----------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 9 WARNINGS AFFECTING 12 LINES
----------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
10 | ERROR | [x] Additional blank lines found at end of doc comment
36 | ERROR | [x] Use null coalesce operator instead of ternary operator.
78 | WARNING | [x] '@TODO.' should match the format '@todo Fix problem X here.'
82 | WARNING | [ ] Code after the RETURN statement on line 79 cannot be executed
83 | WARNING | [ ] Code after the RETURN statement on line 79 cannot be executed
84 | WARNING | [ ] Code after the RETURN statement on line 79 cannot be executed
88 | WARNING | [ ] Code after the RETURN statement on line 79 cannot be executed
89 | WARNING | [ ] Code after the RETURN statement on line 79 cannot be executed
90 | WARNING | [ ] Code after the RETURN statement on line 79 cannot be executed
91 | WARNING | [ ] Code after the RETURN statement on line 79 cannot be executed
92 | WARNING | [ ] Code after the RETURN statement on line 79 cannot be executed
----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------

Comments

Harsh panchal created an issue. See original summary.

Harsh panchal’s picture

Category: Task » Bug report
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new6.94 KB

I have fixed this issue and providing a patch.

pivica’s picture

StatusFileSize
new6.02 KB
new3.42 KB

@Harsh panchal thanks for the issue report.

Hmmm, beside that ternary operator proposal change, other things are mostly cosmetics and there are couple of problems.

1. Just adding some comments to class properties to make PHPCS happy is not ideal. This comments should mean something in proper context. I've tried to improve them a bit.

2. That `return` statements with `@TODO` actually need to be there - that parts of the code we avoid to execute are still not implemented. The module is in early state - working but still in dev version. I've returned all return statements.

And I am not too found on spliting php strings into multiple lines how you did. Also https://www.drupal.org/docs/develop/standards/coding-standards is not mentioning this case. If you can find some better resource where this is documented please share.

Here is a new patch. All in all no real improvements but if it will make phpcs a bit more happy then why not ;)

Note that interdiff is not containing all the changes - missing some comment changes, but was too lazy to regenerate it.

  • pivica committed 5262ecf on 1.x
    Issue #3294077 by pivica, Harsh panchal: Phpcs Drupal coding standard...
pivica’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.