Adjust the module to the Drupal / Drupal JS core CS standards

Created on 12 July 2023, 12 months ago
Updated 13 July 2023, 12 months ago

Problem/Motivation

There are currently several phpcs and eslint issues in the module, which should be fixed:

PHPCS Issues:

FILE: /var/www/html/web/modules/custom/spamspan/src/Form/SpamspanTestForm.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
 24 | 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
 98 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/spamspan/src/TwigExtension/SpamspanExtension.php
---------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
---------------------------------------------------------------------------------------
 31 | ERROR | Parameter $spamspan is not described in comment
 36 | ERROR | Missing parameter name
---------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/spamspan/src/SpamspanTrait.php
-------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
-------------------------------------------------------------------------------------------
 277 | ERROR   | [x] There must be exactly one blank line before the tags in a doc comment
 281 | ERROR   | [ ] Parameter tags must be defined first in a doc comment
 328 | WARNING | [ ] Only string literals should be passed to t() where possible
-------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/spamspan/src/Plugin/Field/FieldFormatter/EmailSpamspanFormatter.php
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------------------------------
  6 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldItemListInterface.
 84 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
-------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/spamspan/src/Plugin/Filter/FilterSpamspan.php
------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------
 26 | WARNING | Line exceeds 80 characters; contains 81 characters
------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/spamspan/spamspan.module
--------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------
 12 | WARNING | @author tags are not usually used in Drupal, because over time multiple contributors will touch the code anyway
--------------------------------------------------------------------------------------------------------------------------------

ESlint core js issues:

  16:9   error    Replace `'span.spamspan'` with `"span.spamspan"`                                                                                                  prettier/prettier
  16:40  warning  Unexpected unnamed function                                                                                                                       func-names 
  18:15  error    Replace `'span.o'` with `"span.o"`                                                                                                                prettier/prettier
  19:13  error    Replace `'span.o',·this).replaceWith('.'` with `"span.o",·this).replaceWith("."`                                                                  prettier/prettier
  25:11  error    Unexpected string concatenation                                                                                                                   prefer-template
  25:13  error    Replace `'span.u'` with `"span.u"`                                                                                                                prettier/prettier
  26:11  error    Replace `'@'` with `"@"`                                                                                                                          prettier/prettier
  27:13  error    Replace `'span.d'` with `"span.d"`                                                                                                                prettier/prettier
  28:27  error    Replace `''` with `""`                                                                                                                            prettier/prettier
  31:23  error    Replace `'mailto:'` with `"mailto:"`                                                                                                              prettier/prettier
  31:23  error    Unexpected string concatenation                                                                                                                   prefer-template
  32:15  error    Replace `'span.h'` with `"span.h"`                                                                                                                prettier/prettier
  35:33  error    Replace `'span.h'` with `"span.h"`                                                                                                                prettier/prettier
  37:40  error    Replace `'$1'` with `"$1"`                                                                                                                        prettier/prettier
  38:65  error    Replace `·n.replace(/:·/,·'=')` with `⏎············n.replace(/:·/,·"=")⏎··········`                                                               prettier/prettier
  40:47  error    Replace `'&'` with `"&"`                                                                                                                          prettier/prettier
  42:24  error    Replace `'?'` with `"?"`                                                                                                                          prettier/prettier
  42:24  error    Unexpected string concatenation                                                                                                                   prefer-template
  48:32  error    Replace `'span.t'` with `"span.t"`                                                                                                                prettier/prettier
  50:71  error    Replace `'$1'` with `"$1"`                                                                                                                        prettier/prettier
  53:51  error    Replace `emailPattern,·function(match)` with `⏎············emailPattern,⏎············function·(match)·`                                           prettier/prettier
  53:65  warning  Unexpected unnamed function                                                                                                                       func-names 
  54:1   error    Replace `············return·match.replace('at',·'@').replace('dot',·'.'` with `··············return·match.replace("at",·"@").replace("dot",·"."`  prettier/prettier
  55:11  error    Replace `}` with `··}⏎··········`                                                                                                                 prettier/prettier
  59:31  error    Replace `'span.e'` with `"span.e"`                                                                                                                prettier/prettier
  60:20  error    Replace `'<a></a>'` with `"<a></a>"`                                                                                                              prettier/prettier
  68:21  error    Replace `'href'` with `"href"`                                                                                                                    prettier/prettier
  69:21  error    Unnecessary use of conditional expression for default assignment                                                                                  no-unneeded-ternary
  70:25  error    Replace `'spamspan'` with `"spamspan"`                                                                                                            prettier/prettier

Steps to reproduce

Proposed resolution

Fix the issues

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

3.0

Component

Code

Created by

🇩🇪Germany Grevil

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

Comments & Activities

Production build 0.69.0 2024