Fix the warnings/errors reported by PHP_CodeSniffer

Created on 11 July 2023, 12 months ago
Updated 1 December 2023, 7 months ago

Problem/Motivation

FILE: /home/lenovo/d7to9/web/modules/contrib/ckeditor_accordion/src/Plugin/CKEditorPlugin/CKEditorAccordion.php
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------
 48 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t()
    |         | instead
-----------------------------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/ckeditor_accordion/src/Plugin/CKEditor4To5Upgrade/Accordion.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
------------------------------------------------------------------------------------------------------------------------------
  8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\ckeditor5\HTMLRestrictions.
 12 | ERROR | [ ] Missing short description in doc comment
 32 | ERROR | [ ] Public method name "Accordion::mapCKEditor4ToolbarButtonToCKEditor5ToolbarItem" is not in lowerCamel format
 45 | ERROR | [ ] Public method name "Accordion::mapCKEditor4SettingsToCKEditor5Configuration" is not in lowerCamel format
 52 | ERROR | [ ] Public method name "Accordion::computeCKEditor5PluginSubsetConfiguration" is not in lowerCamel format
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/ckeditor_accordion/src/Form/CkeditorAccordionSettingsForm.php
---------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------
 12 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
 61 | WARNING | [x] A comma should follow the last multiline array item. Found: )
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/ckeditor_accordion/css/accordion.frontend.css
------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------
 121 | ERROR | [x] Blank lines are not allowed in class definitions
 127 | ERROR | [ ] Class definition is empty
------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/ckeditor_accordion/ckeditor_accordion.install
------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------
 1 | ERROR | [x] Missing file doc comment
------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------

Time: 81ms; Memory: 10MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig ckeditor_accordion/

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

šŸ“Œ Task
Status

Fixed

Version

2.0

Component

Code

Created by

šŸ‡®šŸ‡³India roshni27

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 @roshni27
  • Issue was unassigned.
  • Status changed to Needs review 12 months ago
  • šŸ‡®šŸ‡³India roshni27

    Some issues which are better know to maintainer are pending and all remaining issues solve by me. Please review the patch.

  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi roshni27

    I applied your patch #2 and confirmed that it fixed most of the PHPCS issues, will retain this to needs review for maintainer's response about the remaining PHPCS issues, for convenience below are the remaining issues that is shown in my terminal.

    FILE: /Users/studenttrainees/ckeditor_accordion/css/accordion.frontend.css
    --------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------
    126 | ERROR | Class definition is empty
    --------------------------------------------------------------------------

    FILE: /Users/studenttrainees/ckeditor_accordion/src/Plugin/CKEditor4To5Upgrade/Accordion.php
    --------------------------------------------------------------------------------------------------------------------------
    FOUND 4 ERRORS AFFECTING 4 LINES
    --------------------------------------------------------------------------------------------------------------------------
    12 | ERROR | Missing short description in doc comment
    32 | ERROR | Public method name "Accordion::mapCKEditor4ToolbarButtonToCKEditor5ToolbarItem" is not in lowerCamel format
    45 | ERROR | Public method name "Accordion::mapCKEditor4SettingsToCKEditor5Configuration" is not in lowerCamel format
    52 | ERROR | Public method name "Accordion::computeCKEditor5PluginSubsetConfiguration" is not in lowerCamel format
    --------------------------------------------------------------------------------------------------------------------------

    Time: 259ms; Memory: 10MB

    Command I executed: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml ckeditor_accordion

    Please look at the attached file for your reference,

    Thank you

  • šŸ‡®šŸ‡³India roshni27

    Hi clarkssquared,
    Thanks to review.
    I have mention on above comment some issues are remain which better know to maintainer.

  • šŸ‡®šŸ‡³India Shyam_Bhatt Gujarat

    Added a new patch, to fix all warnings/errors reported by PHP_CodeSniffer. Please check and review.

    + Needs Review.

  • Status changed to RTBC 7 months ago
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi Shyam

    I applied your patch #5 and I confirmed that it fixes all the PHPCS issues.

    āžœ  ckeditor_accordion git:(2.0.x) curl https://www.drupal.org/files/issues/2023-11-10/3373944-5.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  4698  100  4698    0     0   4772      0 --:--:-- --:--:-- --:--:--  4798
    patching file ckeditor_accordion.install
    patching file 'css/accordion.frontend.css'
    patching file 'src/Form/CkeditorAccordionSettingsForm.php'
    patching file 'src/Plugin/CKEditor4To5Upgrade/Accordion.php'
    patching file 'src/Plugin/CKEditorPlugin/CKEditorAccordion.php'
    āžœ  ckeditor_accordion git:(2.0.x) āœ— ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml ckeditor_accordion 
    āžœ  contrib git:(master) āœ— 

    Thanks

  • Status changed to Fixed 7 months ago
  • šŸ‡«šŸ‡®Finland j-vee Turku, Finland

    Fixed all but the function renaming, thanks!

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

Production build 0.69.0 2024