Problem/Motivation
Module's code contains several Drupal Coding Standards issues. This task is created to fix them.
Steps to reproduce
Run the command:
phpcs --standard=Drupal,DrupalPractice <project_root>/web/modules/contrib/map_object_field/
Proposed resolution
Fix the following coding standards issues and upload the patch or create an MR with fixes.
FILE: modules\contrib\map_object_field\assets\css\map-object-field-default-formatter.css
---------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
---------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------
FILE: modules\contrib\map_object_field\assets\css\map-object-field-default-widget-config.css
-------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
-------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------
FILE: modules\contrib\map_object_field\assets\css\map-object-field-default-widget.css
------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------
FILE: modules\contrib\map_object_field\assets\js\map-object-field-default-formatter.js
-------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
-------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------
FILE: modules\contrib\map_object_field\assets\js\map-object-field-default-widget-config.js
-----------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
-----------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------
FILE: modules\contrib\map_object_field\assets\js\map-object-field-default-widget.js
----------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------
FILE: modules\contrib\map_object_field\src\Plugin\Field\FieldFormatter\MapObjectFieldDefaultFormatter.php
--------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------------------------------------------------------
28 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
52 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------------------------------------------------------
FILE: modules\contrib\map_object_field\src\Plugin\Field\FieldWidget\MapObjectFieldDefaultWidget.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
------------------------------------------------------------------------------------------------------------------------------------------
83 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
127 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
201 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
317 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------------------------------------------
FILE: modules\contrib\map_object_field\src\Plugin\views\style\SingleMap.php
--------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------------------------
138 | WARNING | Unused variable $element.
142 | WARNING | Unused variable $index.
--------------------------------------------------------------------------------------------------
Time: 7.15 secs; Memory: 14MB
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | map_object_field-fix-phpcs-issues-3359046-12.patch | 15.79 KB | ysamoylenko |
Issue fork map_object_field-3359046
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:
- 3359046-fix-the-issues
changes, plain diff MR !1
- 3359046-phpsec-issue-2
changes, plain diff MR !2
Comments
Comment #2
ysamoylenko commentedComment #3
avpadernoComment #7
avpadernoThe report shows warnings/errors for nine files, but the MR changes only eight files. Either the report is not correct and must be changed, or the MR needs to change only the files for which the report shows warnings/errors.
Comment #9
avpadernoThat description is still repeating the class name; it just added spaces. That is not describing what the class does.
Comment #11
volha_si commentedCreated pull request to fix warnings like "\Drupal calls should be avoided in classes, use dependency injection instead". Because _pratik_'s MR doesn't fix these warnings.
Comment #12
ysamoylenko commentedHello, I fixed DI issues in my patch. Please review.
Comment #13
avpadernoSince there is already a MR, it would be better to continue using it.
Comment #14
volha_si commentedThe attached patch (#12) looks good for me, please commit the changes.
Comment #15
volha_si commentedComment #17
ysamoylenko commentedThank you for your efforts in preparing the fixes and review. The changes have been committed.