Fix issues reported by phpcs.

Created on 27 June 2023, over 1 year ago
Updated 28 June 2023, over 1 year ago

Problem/Motivation

Phpcs reported the following errors/warnings.

FILE: /home/arpitkayare/drupal_9.5/web/modules/contrib/progresscirclebar/progresscirclebar.libraries.yml
--------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------
14 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------

FILE: /home/arpitkayare/drupal_9.5/web/modules/contrib/progresscirclebar/src/Form/ProgressSettingsForm.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 14 WARNINGS AFFECTING 14 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
36 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
37 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
39 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
40 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
42 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
43 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
45 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
46 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
50 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
56 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
62 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
68 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
85 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
90 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-----------------------------------------------------------------------------------------------------------------------------------------

FILE: /home/arpitkayare/drupal_9.5/web/modules/contrib/progresscirclebar/src/Plugin/Field/FieldFormatter/ProgressCircleFormatter.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
------------------------------------------------------------------------------------------------------------------------------------
30 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
31 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
33 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
34 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------------------------------------

FILE: /home/arpitkayare/drupal_9.5/web/modules/contrib/progresscirclebar/src/Plugin/Field/FieldFormatter/ProgressBarFormatter.php
---------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
---------------------------------------------------------------------------------------------------------------------------------
30 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
31 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
33 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
34 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------------------------------------------

Steps to reproduce

Run phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,js .

Proposed resolution

Fix the errors/warnings and create a patch and get is reviewed.

Remaining tasks

NA

User interface changes

NA

API changes

NA

Data model changes

NA

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India arpitk

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Comments & Activities

  • Issue created by @arpitk
  • @arpitk opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India arpitk

    Fixed the errors/warning reported by phpcs. Please review the MR.

    Thanks!

  • Status changed to RTBC over 1 year ago
  • 🇵🇭Philippines clarkssquared

    Hi arpitk

    I applied your MR !1 to my local and I confirmed that your patch fixes all the PHPCS errors/warnings.

    Please look at the screenshot attached for your reference

    Thank you

  • Status changed to Fixed over 1 year ago
  • 🇮🇳India zeeshan_khan

    Thanks @arpitk - for the fix and Thanks @clarkssquared - for the review.

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

Production build 0.71.5 2024