Fix the issues reported by phpcs

Created on 17 July 2023, over 1 year ago
Updated 25 September 2023, about 1 year ago

Problem/Motivation

FILE: ...hjain/www/drupal/modules/contrib/wysiwyg_template/wysiwyg_template.install
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
10 | ERROR | [ ] The array declaration extends to column 96 (the limit is 80).
| | The array content should be split up over multiple lines
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...ww/drupal/modules/contrib/wysiwyg_template/wysiwyg_template.links.menu.yml
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
6 | ERROR | [x] Expected 1 newline at end of file; 2 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...ib/wysiwyg_template/tests/src/Kernel/Controller/TemplateControllerTest.php
--------------------------------------------------------------------------------
FOUND 5 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
--------------------------------------------------------------------------------
9 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be
| | referenced with use statements
50 | WARNING | [x] 'TODO: Change the autogenerated stub' should match the
| | format '@todo Fix problem X here.'
50 | WARNING | [ ] There must be no blank line following an inline comment
50 | ERROR | [x] Comments may not appear after statements
50 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
133 | ERROR | [x] Doc comment short description must end with a full stop
135 | ERROR | [ ] Missing parameter type
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /Users/sourabhjain/www/drupal/modules/contrib/wysiwyg_template/README.md
------------------------------------------------------------------------------
FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
------------------------------------------------------------------------------
20 | WARNING | Line exceeds 80 characters; contains 176 characters
22 | WARNING | Line exceeds 80 characters; contains 137 characters
48 | WARNING | Line exceeds 80 characters; contains 145 characters
57 | WARNING | Line exceeds 80 characters; contains 87 characters
61 | WARNING | Line exceeds 80 characters; contains 112 characters
63 | WARNING | Line exceeds 80 characters; contains 95 characters
------------------------------------------------------------------------------

FILE: ...sers/sourabhjain/www/drupal/modules/contrib/wysiwyg_template/CHANGELOG.txt
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
--------------------------------------------------------------------------------
4 | WARNING | Line exceeds 80 characters; contains 99 characters
10 | WARNING | Line exceeds 80 characters; contains 95 characters
25 | WARNING | Line exceeds 80 characters; contains 207 characters
29 | WARNING | Line exceeds 80 characters; contains 87 characters
31 | WARNING | Line exceeds 80 characters; contains 82 characters
--------------------------------------------------------------------------------

FILE: ...bhjain/www/drupal/modules/contrib/wysiwyg_template/wysiwyg_template.module
--------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
--------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
26 | ERROR | [x] Use "elseif" in place of "else if"
38 | ERROR | [ ] The array declaration extends to column 115 (the limit is
| | 80). The array content should be split up over multiple lines
64 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...siwyg_template_core/tests/src/Kernel/Plugin/Filter/FilterTemplatesTest.php
--------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
--------------------------------------------------------------------------------
44 | ERROR | [ ] Missing parameter type
46 | ERROR | [ ] Missing parameter type
55 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
71 | ERROR | [ ] The array declaration extends to column 84 (the limit is 80).
| | The array content should be split up over multiple lines
72 | ERROR | [ ] The array declaration extends to column 85 (the limit is 80).
| | The array content should be split up over multiple lines
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...b/wysiwyg_template/modules/wysiwyg_template_core/src/TemplateInterface.php
--------------------------------------------------------------------------------
FOUND 9 ERRORS AND 1 WARNING AFFECTING 9 LINES
--------------------------------------------------------------------------------
5 | WARNING | [x] Unused use statement
11 | ERROR | [x] Expected 1 space after interface name; 2 found
11 | ERROR | [x] Expected 1 space before opening brace; found 2
48 | ERROR | [ ] Description for the @return value is missing
55 | ERROR | [ ] Missing parameter comment
57 | ERROR | [ ] Description for the @return value is missing
61 | ERROR | [ ] Missing short description in doc comment
62 | ERROR | [ ] Missing parameter comment
63 | ERROR | [ ] Missing parameter comment
65 | ERROR | [ ] Description for the @return value is missing
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...ww/drupal/modules/contrib/wysiwyg_template/src/Form/TemplateDeleteForm.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
17 | ERROR | [x] Expected 1 blank line before function; 0 found
18 | ERROR | [x] Short array syntax must be used to define arrays
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...jain/www/drupal/modules/contrib/wysiwyg_template/src/Form/TemplateForm.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 4 WARNINGS AFFECTING 6 LINES
--------------------------------------------------------------------------------
5 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be
| | referenced with use statements
6 | WARNING | [x] Unused use statement
9 | WARNING | [x] Unused use statement
15 | WARNING | [ ] The class short comment should describe what the class does
| | and not simply repeat the class name
38 | ERROR | [x] Short array syntax must be used to define arrays
66 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...bhjain/www/drupal/modules/contrib/wysiwyg_template/src/Entity/Template.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 4 WARNINGS AFFECTING 5 LINES
--------------------------------------------------------------------------------
6 | WARNING | [x] Unused use statement
83 | ERROR | [x] Expected "int" but found "integer" for @var tag in member
| | variable comment
196 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
217 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
230 | WARNING | [ ] Line exceeds 80 characters; contains 84 characters
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...s/sourabhjain/www/drupal/modules/contrib/wysiwyg_template/src/Services.php
--------------------------------------------------------------------------------
FOUND 9 ERRORS AFFECTING 9 LINES
--------------------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
4 | ERROR | [x] There must be one blank line after the namespace declaration
12 | ERROR | [x] Missing class doc comment
14 | ERROR | [ ] Missing short description in doc comment
19 | ERROR | [ ] Missing short description in doc comment
24 | ERROR | [ ] Missing short description in doc comment
29 | ERROR | [x] Missing function doc comment
35 | ERROR | [x] Missing function doc comment
50 | ERROR | [ ] The array declaration extends to column 96 (the limit is 80).
| | The array content should be split up over multiple lines
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...in/www/drupal/modules/contrib/wysiwyg_template/src/Tests/Form/CrudTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 8 WARNINGS AFFECTING 9 LINES
--------------------------------------------------------------------------------
35 | ERROR | The array declaration extends to column 97 (the limit is 80).
| | The array content should be split up over multiple lines
46 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
49 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
57 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
70 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
77 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
78 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
93 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
102 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
--------------------------------------------------------------------------------

FILE: ...w/drupal/modules/contrib/wysiwyg_template/src/Tests/DefaultContentTest.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
77 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
87 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
--------------------------------------------------------------------------------

FILE: ...es/contrib/wysiwyg_template/src/Plugin/CKEditorPlugin/TemplateSelector.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
49 | ERROR | [x] Closing parenthesis of array declaration must be on a new
| | line
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...pal/modules/contrib/wysiwyg_template/src/Controller/TemplateController.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
7 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be
| | referenced with use statements
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 220ms; Memory: 10MB

Steps to reproduce

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml wysiwyg_template

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

Needs review

Version

3.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia sourabhjain

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 @sourabhjain
  • @sourabhjain opened merge request.
  • Status changed to Needs work over 1 year ago
  • Assigned to nitin_lama
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India

    Issues remaining are:

    FILE: /home/system/Documents/contribution/wysiwyg_template-3374922/CHANGELOG.txt
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
    --------------------------------------------------------------------------------
      4 | WARNING | Line exceeds 80 characters; contains 99 characters
     10 | WARNING | Line exceeds 80 characters; contains 95 characters
     25 | WARNING | Line exceeds 80 characters; contains 207 characters
     29 | WARNING | Line exceeds 80 characters; contains 87 characters
     31 | WARNING | Line exceeds 80 characters; contains 82 characters
    --------------------------------------------------------------------------------
    
    
    FILE: /home/system/Documents/contribution/wysiwyg_template-3374922/README.md
    ----------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------
     61 | WARNING | Line exceeds 80 characters; contains 87 characters
    ----------------------------------------------------------------------------
    
    
    FILE: /home/system/Documents/contribution/wysiwyg_template-3374922/modules/wysiwyg_template_core/src/TemplateInterface.php
    --------------------------------------------------------------------------------------------------------------------------
    FOUND 7 ERRORS AFFECTING 7 LINES
    --------------------------------------------------------------------------------------------------------------------------
     47 | ERROR | Description for the @return value is missing
     54 | ERROR | Missing parameter comment
     56 | ERROR | Description for the @return value is missing
     60 | ERROR | Missing short description in doc comment
     61 | ERROR | Missing parameter comment
     62 | ERROR | Missing parameter comment
     64 | ERROR | Description for the @return value is missing
    --------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/system/Documents/contribution/wysiwyg_template-3374922/modules/wysiwyg_template_core/tests/src/Kernel/Plugin/Filter/FilterTemplatesTest.php
    -------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    -------------------------------------------------------------------------------------------------------------------------------------------------------
     44 | ERROR | Missing parameter type
     46 | ERROR | Missing parameter type
    -------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/system/Documents/contribution/wysiwyg_template-3374922/src/Entity/Template.php
    ------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    ------------------------------------------------------------------------------------------
     195 | WARNING | Line exceeds 80 characters; contains 82 characters
     216 | WARNING | Line exceeds 80 characters; contains 81 characters
     229 | WARNING | Line exceeds 80 characters; contains 84 characters
    ------------------------------------------------------------------------------------------
    
    
    FILE: /home/system/Documents/contribution/wysiwyg_template-3374922/src/Form/TemplateForm.php
    -----------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------
     12 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
    -----------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/system/Documents/contribution/wysiwyg_template-3374922/src/Services.php
    -------------------------------------------------------------------------------------------------------------------------------------
    FOUND 7 ERRORS AFFECTING 7 LINES
    -------------------------------------------------------------------------------------------------------------------------------------
     10 | ERROR | Doc comment is empty
     15 | ERROR | Missing short description in doc comment
     20 | ERROR | Missing short description in doc comment
     25 | ERROR | Missing short description in doc comment
     30 | ERROR | Doc comment is empty
     39 | ERROR | Doc comment is empty
     57 | ERROR | The array declaration extends to column 96 (the limit is 80). The array content should be split up over multiple lines
    -------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/system/Documents/contribution/wysiwyg_template-3374922/wysiwyg_template.install
    -------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    -------------------------------------------------------------------------------------------------------------------------------------
      3 | ERROR | Missing short description in doc comment
     14 | ERROR | The array declaration extends to column 96 (the limit is 80). The array content should be split up over multiple lines
    -------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/system/Documents/contribution/wysiwyg_template-3374922/tests/src/Kernel/Controller/TemplateControllerTest.php
    -------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------
     135 | ERROR | Missing parameter type
    -------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/system/Documents/contribution/wysiwyg_template-3374922/wysiwyg_template.module
    ------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------
     3 | ERROR | Missing short description in doc comment
    ------------------------------------------------------------------------------------------
    
    Time: 114ms; Memory: 8MB
    
    FILE: /home/system/Documents/contribution/wysiwyg_template-3374922/src/Form/TemplateForm.php
    ---------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------
     63 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    ---------------------------------------------------------------------------------------------
    
    Time: 87ms; Memory: 6MB
    
  • Issue was unassigned.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sourabhjain

    @sakhti please add the interdiff file.

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines clarkssquared

    Hi sakthi_dev

    I applied and reviewed your patch #7 and I confirmed that your patch fixed all the PHPCS errors in my end. However, there are whitespace errors existing in your patch.

    Please look at the screenshot I attached for your reference, I highlighted the errors for your convenience.

    Thank you

  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia mrinalini9 New Delhi

    Updated patch #7 by addressing #9, please review it.

    Thanks!

  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines clarkssquared

    Hi mrinalini9

    I applied your patch #10 to my local and I confirmed that it applied cleanly without whitespace errors and fixed all the PHPCS errors, retaining the status to needs review so that others can review and verify your patch.

    This is RTBC +1 for me.

    Please look at the screenshot I attached for your reference.

    Thank you

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany jurgenhaas Gottmadingen

    Can we please ditch the patch files and collaborate on the merge request?

    And please don't upload any screenshots. That's not helping for anything. Please review Issue etiquette โ†’

  • Assigned to mohd sahzad
  • Issue was unassigned.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia chetan 11

    chetan 11 โ†’ made their first commit to this issueโ€™s fork.

  • @chetan-11 opened merge request.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia chetan 11

    Hi @sourabhjain
    I have fixed all the issues on above module & raised MR for the updated code, please verify this request.

  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany jurgenhaas Gottmadingen
Production build 0.71.5 2024