Coding standards and best practices
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3326168. -->
Reported by: [akshay.singh](https://www.drupal.org/user/3592022)
>>>
<p>Hi, While reviewing the module for best practices and standards. I have found this with the help of PHPCS and fixed it:</p>
<pre>phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml ../gin_login/<br><br>FILE: /var/www/html/dContri/gin_login/gin_login.module<br>-----------------------------------------------------------------------------<br>FOUND 4 ERRORS AND 3 WARNINGS AFFECTING 6 LINES<br>-----------------------------------------------------------------------------<br> 170 | ERROR | [ ] Comment indentation error, expected only 1 spaces<br> 173 | WARNING | [ ] Line exceeds 80 characters; contains 101 characters<br> 173 | ERROR | [ ] Comment indentation error, expected only 1 spaces<br> 175 | ERROR | [ ] Comment indentation error, expected only 3 spaces<br> 179 | WARNING | [ ] There must be no blank line following an inline comment<br> 190 | WARNING | [ ] Unused variable $darkmode.<br> 215 | ERROR | [x] Expected newline after closing brace<br>-----------------------------------------------------------------------------<br><br><br>FILE: /var/www/html/dContri/gin_login/src/Form/GinLoginConfigurationForm.php<br>------------------------------------------------------------------------------------------------------------------------------------------<br>FOUND 0 ERRORS AND 14 WARNINGS AFFECTING 14 LINES<br>------------------------------------------------------------------------------------------------------------------------------------------<br> 38 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead<br> 43 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead<br> 59 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead<br> 64 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead<br> 66 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead<br> 76 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead<br> 81 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead<br> 96 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead<br> 101 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead<br> 103 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead<br>------------------------------------------------------------------------------------------------------------------------------------------<br><br><br>FILE: /var/www/html/dContri/gin_login/src/Theme/ThemeNegotiator.php<br>----------------------------------------------------------------------------------------------------------------------------------<br>FOUND 14 ERRORS AND 1 WARNING AFFECTING 11 LINES<br>----------------------------------------------------------------------------------------------------------------------------------<br> 11 | WARNING | [ ] Line exceeds 80 characters; contains 88 characters<br> 11 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph<br> 15 | ERROR | [x] The open comment tag must be the only content on the line<br> 15 | ERROR | [ ] Missing short description in doc comment<br> 15 | ERROR | [x] Data types in @var tags need to be fully namespaced<br> 15 | ERROR | [x] Expected "ConfigFactoryInterface" but found "ConfigFactoryInterface " for @var tag in member variable comment<br> 18 | ERROR | [x] Missing function doc comment<br> 24 | ERROR | [ ] Missing short description in doc comment<br> 25 | ERROR | [ ] Missing parameter comment<br> 26 | ERROR | [ ] Description for the @return value is missing<br> 32 | ERROR | [ ] Missing short description in doc comment<br> 33 | ERROR | [ ] Missing parameter comment<br> 34 | ERROR | [ ] Description for the @return value is missing<br> 43 | ERROR | [ ] Missing parameter comment<br> 45 | ERROR | [ ] Description for the @return value is missing<br>----------------------------------------------------------------------------------------------------------------------------------<br><br><br>FILE: /var/www/html/dContri/gin_login/dist/css/login.css<br>--------------------------------------------------------------------------<br>FOUND 7 ERRORS AFFECTING 7 LINES<br>--------------------------------------------------------------------------<br> 72 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 10<br> 74 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 10<br> 76 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 10<br> 78 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 10<br> 101 | ERROR | [x] Multiple selectors should each be on a single line<br> 104 | ERROR | [x] Multiple selectors should each be on a single line<br> 108 | ERROR | [x] Multiple selectors should each be on a single line<br>--------------------------------------------------------------------------</pre>
issue