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


Command icon 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:

Comments

ysamoylenko created an issue. See original summary.

ysamoylenko’s picture

Issue summary: View changes
avpaderno’s picture

Title: Drupal coding standards issues » Fix the issues reported by phpcs
Priority: Normal » Minor
Issue tags: +Coding standards

_pratik_ made their first commit to this issue’s fork.

Volha_Si made their first commit to this issue’s fork.

avpaderno’s picture

Status: Active » Needs work

The 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.

sakthi_dev made their first commit to this issue’s fork.

avpaderno’s picture

- * Class MapObjectFieldLib.
+ * Map Object Field class.

That description is still repeating the class name; it just added spaces. That is not describing what the class does.

volha_si’s picture

Created 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.

ysamoylenko’s picture

Status: Needs work » Needs review
StatusFileSize
new15.79 KB

Hello, I fixed DI issues in my patch. Please review.

avpaderno’s picture

Since there is already a MR, it would be better to continue using it.

volha_si’s picture

The attached patch (#12) looks good for me, please commit the changes.

volha_si’s picture

Status: Needs review » Reviewed & tested by the community

  • ysamoylenko committed 6ad21809 on 2.x
    Issue #3359046 by _pratik_, ysamoylenko, Volha_Si, sakthi_dev: Fix the...
ysamoylenko’s picture

Status: Reviewed & tested by the community » Fixed

Thank you for your efforts in preparing the fixes and review. The changes have been committed.

Status: Fixed » Closed (fixed)

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