Closed (fixed)
Project:
Permissions Policy
Version:
1.1.x-dev
Component:
Code
Priority:
Minor
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
6 Feb 2023 at 09:45 UTC
Updated:
24 Feb 2023 at 05:44 UTC
Jump to comment: Most recent
Coder currently identifies some coding standards issues:
FILE: /var/www/html/web/modules/contrib/permissionspolicy/tests/src/Unit/PermissionsPolicyTest.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 6 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
107 | ERROR | [ ] The array declaration extends to column 90 (the limit is 80). The array content should be split up over multiple lines
126 | ERROR | [ ] The array declaration extends to column 88 (the limit is 80). The array content should be split up over multiple lines
152 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
181 | ERROR | [x] No space found before comment text; expected "// @todo should appending an empty value result in an empty list?" but found "//@todo should appending an empty
| | value result in an empty list?"
202 | ERROR | [ ] The array declaration extends to column 103 (the limit is 80). The array content should be split up over multiple lines
356 | ERROR | [ ] The array declaration extends to column 81 (the limit is 80). The array content should be split up over multiple lines
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/web/modules/contrib/permissionspolicy/src/Form/PermissionsPolicySettingsForm.php
----------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 4 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------------------------------------------------------------------------
36 | WARNING | Unused private method getConfigurableFeatures()
245 | WARNING | #options values usually have to run through t() for translation
246 | WARNING | #options values usually have to run through t() for translation
247 | WARNING | #options values usually have to run through t() for translation
292 | ERROR | The array declaration extends to column 99 (the limit is 80). The array content should be split up over multiple lines
----------------------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/web/modules/contrib/permissionspolicy/src/PermissionsPolicy.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------
156 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
-----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------
Time: 229ms; Memory: 10MB
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:
Comments
Comment #3
ptmkenny commentedThis MR fixes all of the above warnings except the following:
I did not fix the "inline comments" warning because it adds a period to the end of some code, whereas the point of the rule is to end sentences in a period.
I left the private method in place because I assume it will be used at some point.
I think the "#options values usually have to run through t() for translation" can be ignored because the options are the actual values used for the permission policy spec and not language dependent. I would ignore them in the linter but I couldn't find a good way to do that.
Comment #4
gappleThe private method is actually already used, the sniff just appears to not pickup if a method is being called via
selforstaticAdding
phpcs:disable sniffNameto the relevant method/class/file docblock will suppress that sniff for the corresponding code block.Comment #5
gapple