Problem/Motivation

Getting following error/warnings.

FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\representative_image\src\Plugin\Field\FieldFormatter\EntityReferenceRepresentativeImage.php
----------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------------------
82 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
----------------------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\representative_image\src\Plugin\migrate\source\FieldConfig.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------
42 | ERROR | unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.
-------------------------------------------------------------------------------------------------------------------------------------------

Time: 421ms; Memory: 12MB

Steps to reproduce

Run following command

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/representative_image/

Proposed resolution

Above error/warnings need to be fixed

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

samit.310@gmail.com created an issue. See original summary.

samitk’s picture

Assigned: samitk » Unassigned
Status: Needs work » Needs review
StatusFileSize
new2.83 KB

Above errors/warnings has been fixed.

Status: Needs review » Needs work

The last submitted patch, 2: 3349232-2.patch, failed testing. View results

rassoni’s picture

Title: Drupal Coding Standards Issues | phpcs » Fix the issues reported by phpcs
Issue summary: View changes
Priority: Normal » Minor
Issue tags: -Coding standards Phpcs, -Phpcs Drupal coding standard issue

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

sagartiwari’s picture

Assigned: Unassigned » sagartiwari
sagartiwari’s picture

Assigned: sagartiwari » Unassigned

shivam_tiwari’s picture

Status: Needs work » Needs review
avpaderno’s picture

Status: Needs review » Needs work

The tests are failing for a reason. See the plain diff of the latest MR created.

Neeraj333’s picture

Status: Needs work » Needs review
StatusFileSize
new2.8 KB

Status: Needs review » Needs work

The last submitted patch, 11: fix_coding_standard-3349232-11.patch, failed testing. View results

Shreyas gowda’s picture

StatusFileSize
new1.95 KB
shank115’s picture

StatusFileSize
new12.2 KB

I applied the patch provided in #13 and it applied successfully.

zkhan.aamir’s picture

Remaining issues after patch #13.

Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules
$ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,js,yml representative_image/

FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\representative_image\src\Plugin\Field\FieldFormatter\EntityReferenceRepresentativeImage.php
----------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------------------
 82 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
----------------------------------------------------------------------------------------------------------------------------------------------------


FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\representative_image\src\Plugin\migrate\source\FieldConfig.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------
 42 | ERROR | unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.
-------------------------------------------------------------------------------------------------------------------------------------------

Time: 421ms; Memory: 12MB
zkhan.aamir’s picture

Issue summary: View changes

Issue summary updated.

nitin_lama’s picture

Assigned: Unassigned » nitin_lama
nitin_lama’s picture

StatusFileSize
new3.4 KB

Providing updated patch.

nitin_lama’s picture

Status: Needs work » Needs review

Please review. Thanks.

nitin_lama’s picture

Assigned: nitin_lama » Unassigned

The last submitted patch, 13: phpcs_fix.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 18: 3349232-18.patch, failed testing. View results