Fix the issues reported by phpcs

Created on 5 April 2023, about 1 year ago
Updated 17 July 2023, 12 months ago

Problem/Motivation

Getting these phpcs errors and warnings

FILE: /filter_tooltips/css/filter_tooltips.autocomplete.css
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 26 | ERROR | [x] Expected 1 space before opening brace of class definition; 2
    |       |     found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /filter_tooltips/filter_tooltips.routing.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 16 | WARNING | Open page callback found, please add a comment before the line
    |         | why there is no access restriction
--------------------------------------------------------------------------------


FILE: /filter_tooltips/filter_tooltips.module
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------------
 224 | ERROR   | [x] Functions must not contain multiple empty lines in a row;
     |         |     found 2 empty lines
 226 | WARNING | [ ] Unused variable $allowed_html.
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /filter_tooltips/filter_tooltips.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 1 | WARNING | Remove "project" from the info file, it will be added by
   |         | drupal.org packaging automatically
 1 | WARNING | Remove "datestamp" from the info file, it will be added by
   |         | drupal.org packaging automatically
 1 | WARNING | Remove "version" from the info file, it will be added by
   |         | drupal.org packaging automatically
 8 | WARNING | All dependencies must be prefixed with the project name, for
   |         | example "drupal:"
--------------------------------------------------------------------------------


FILE: /filter_tooltips/src/Plugin/CKEditorPlugin/CKEditorTooltips.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 34 | WARNING | t() calls should be avoided in classes, use
    |         | \Drupal\Core\StringTranslation\StringTranslationTrait and
    |         | $this->t() instead
 45 | WARNING | t() calls should be avoided in classes, use
    |         | \Drupal\Core\StringTranslation\StringTranslationTrait and
    |         | $this->t() instead
 46 | WARNING | t() calls should be avoided in classes, use
    |         | \Drupal\Core\StringTranslation\StringTranslationTrait and
    |         | $this->t() instead
--------------------------------------------------------------------------------


FILE: /filter_tooltips/src/Plugin/Filter/FilterTooltips.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 167 | WARNING | [ ] #options values usually have to run through t() for
     |         |     translation
 168 | WARNING | [ ] #options values usually have to run through t() for
     |         |     translation
 195 | ERROR   | [x] Whitespace found at end of line
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /filter_tooltips/src/Controller/AutocompleteController.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 82 | WARNING | \Drupal calls should be avoided in classes, use dependency
    |         | injection instead
--------------------------------------------------------------------------------

Steps to reproduce

run this command in file directory
phpcs --standard="Drupal,DrupalPractice" --extensions="php,module,inc,install,test,profile,theme,css,info,txt,md,yml"

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India TanujJain-TJ

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

Production build 0.69.0 2024