Problem/Motivation
Getting the following phpcs errors/warnings:
FILE: tests/src/Functional/ColorFieldFormatterTest.php
-----------------------------------------------
FOUND 0 ERRORS AND 8 WARNINGS AFFECTING 8 LINES
------------------------------------------------
49 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
69 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
88 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
107 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
136 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
156 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
186 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
208 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------
FILE: tests/src/Functional/ColorFieldWidgetTest.php
------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------
43 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------
FILE: tests/src/Functional/ColorFieldFormatterTokenTest.php
------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------
55 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
94 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------
FILE: src/Plugin/Field/FieldFormatter/ColorFieldFormatterCss.php
------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------
155 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
162 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------
Steps to reproduce
Run the following command from the module folder:
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml .
Proposed resolution
Fix the errors and warnings.
| Comment | File | Size | Author |
|---|
Issue fork color_field-3338149
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
Comment #2
mrinalini9 commentedAdded patch for the above fixes here, please review it.
Comment #3
arisenReviewed the patch on 3.0.x branch. The patch is applying cleanly but getting additional code standards error.
Comment #4
adil_siddiqui commentedPatch created with all above issue fixed
Comment #5
avpadernoComment #7
urvashi_vora commentedReviewed and Tested Patch 3338149-4.patch.
The patch applied smoothly
Still there are a few issues left, which can fixed by phpcbf, I will fix them and create a MR.
Comment #8
urvashi_vora commentedFixed all the issue, Please review.
Comment #10
paraderojether commentedI reviewed MR!13, and applied it against Color Field 3.0.x-dev cleanly and confirmed it fixes all the issues reported by phpcs.
I added screenshots for reference.
Thank You.
Comment #11
avpadernoComment #13
zkhan.aamir commentedComment #14
avpadernoThe MR is still using
NULLandTRUEin JavaScript files, while they are used in PHP code. In JavaScript, it is correct to usenullandtrue.Comment #16
sakthi_dev commentedUpdated to lower case in JS.
Comment #17
avpadernoComment #18
sakthi_dev commentedAddressed comments in MR. Please review.
Comment #19
nikolay shapovalov commentedUpdate IS, add new phpcs report.
Comment #20
nikolay shapovalov commentedPlease remove changes that is not necessary, and not marked as violation by phpcs report.
Comment #21
nikolay shapovalov commentedComment #24
arijit acharya commentedAdded a MR which resolves the errors thrown by phpcs.
Please review and merge.
Comment #25
arijit acharya commentedComment #26
silvi.addweb commentedHi, I have tested MR 22. There are no remaining issues. Moving to RTBC.
Comment #30
avpadernoGitLAb CI does not report any PHP_CodeSniffer warning/error that should be fixed.