Fix the issues reported by phpcs

Created on 11 January 2023, almost 2 years ago
Updated 20 March 2023, over 1 year ago

phpcs --standard=DrupalPractice shows the following report.

FILE: tests/src/Functional/FontYourFaceInstallTest.php
------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
-------------------------------------------------------
 54 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t()
    |         | instead
 58 | 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
 66 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t()
    |         | instead
 67 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t()
    |         | instead
-------------------------------------------------------


FILE: tests/src/Functional/FontYourFaceSubmoduleInstallTest.php
-------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
-------------------------------------------------------
 52 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t()
    |         | instead
 53 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t()
    |         | instead
 67 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t()
    |         | instead
-------------------------------------------------------

FILE: tests/src/Functional/FontYourFaceLocalFontInstallTest.php
-------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-------------------------------------------------------
 52 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t()
    |         | instead
 54 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t()
    |         | instead
-------------------------------------------------------


FILE: modules/local_fonts/src/Form/LocalFontConfigEntityForm.php
---------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
---------------------------------------
 131 | WARNING | File::load calls should be avoided in classes, use dependency injection instead
 139 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 145 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------


FILE: src/Form/FontForm.php
----------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
----------------
 21 | WARNING | Unused variable $entity.
 35 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 41 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------


FILE: src/Form/FontDisplayForm.php
-----------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
-----------------
  46 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  56 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 173 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 179 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-----------------


FILE: src/Form/FontSettingsForm.php
-----------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
-----------------
  57 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  83 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  86 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 123 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 138 | WARNING | Unused variable $config.
-----------------


FILE: src/Controller/FontYourFaceController.php
----------------------
FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
----------------------
  28 | 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
  58 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  75 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  92 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 105 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------


FILE: src/Plugin/views/filter/FontYourFaceStyleFilter.php
--------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------
 55 | WARNING | Unused variable $exposed.
--------------------------------


FILE: src/Plugin/views/filter/FontYourFaceProviderFilter.php
-----------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
-----------------------------------
 44 | WARNING | Unused variable $name.
 47 | WARNING | Unused variable $name.
 59 | WARNING | Unused variable $exposed.
-----------------------------------


FILE: src/Plugin/views/filter/FontYourFaceWeightFilter.php
---------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------
 62 | WARNING | Unused variable $exposed.
---------------------------------

Those files need to be changed to fix the reported issues

📌 Task
Status

Fixed

Version

3.0

Component

Code (general)

Created by

🇧🇷Brazil hmendes

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • Status changed to Needs work almost 2 years ago
  • Assigned to WagnerMelo
  • 🇧🇷Brazil WagnerMelo Recife, Pernambuco

    Hi, i'll work on it. XD

  • Issue was unassigned.
  • 🇧🇷Brazil WagnerMelo Recife, Pernambuco

    Hello, when I got this problem I noticed that all the errors pointed out by phpcs were resolved in #4, but the tests failed, I tried to solve the tests but now I don't have enough knowledge to solve these errors. And I don't know if it's correct to resolve this test error in this issue or create another one just to solve tests.
    If it is necessary to create another issue to resolve the tests, I believe this issue can be moved to RTBC as the phpcs errors are gone.
    I'll let this issue in needs works, and waiting someone with more experience to point which is the best way to proceed with that.

  • 🇧🇷Brazil WagnerMelo Recife, Pernambuco

    I hope helped with my comment.

  • First commit to issue fork.
  • 🇧🇷Brazil lucienchalom

    I manage to fix most of the errors on test.
    The last one that i couldn't fix i reverted the DI, so someone else can do it.

  • Status changed to Needs review almost 2 years ago
  • 🇧🇷Brazil elber Brazil

    Hi I fixed the tests and finished the dependencies injections.

  • Status changed to RTBC over 1 year ago
  • 🇧🇷Brazil lucienchalom

    Thank you!
    all the coding standards were fixed, and all the tests passing.
    Moving to RTBC

  • Status changed to Fixed over 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024