Drupal Coding Standards Issues | phpcs

Created on 28 February 2023, almost 2 years ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/term_merge_manager/term_merge_manager.links.task.yml
----------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------
33 | ERROR | [x] Expected 1 newline at end of file; 2 found
----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/term_merge_manager/term_merge_into.page.inc
-------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------
24 | WARNING | Unused variable $term_merge_into.
-------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/term_merge_manager/term_merge_from.page.inc
-------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------
24 | WARNING | Unused variable $term_merge_from.
-------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/term_merge_manager/term_merge_manager.module
--------------------------------------------------------------------------------------------------------------------------------------------
FOUND 12 ERRORS AND 1 WARNING AFFECTING 9 LINES
--------------------------------------------------------------------------------------------------------------------------------------------
29 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
33 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
36 | ERROR | [x] Inline comments must start with a capital letter
36 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
53 | WARNING | [ ] Line exceeds 80 characters; contains 126 characters
54 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
57 | ERROR | [x] Inline control structures are not allowed
63 | ERROR | [ ] The array declaration extends to column 138 (the limit is 80). The array content should be split up over multiple lines
73 | ERROR | [x] There must be exactly one blank line before the tags in a doc comment
73 | ERROR | [ ] Missing parameter comment
73 | ERROR | [ ] Missing parameter type
79 | ERROR | [x] Inline comments must start with a capital letter
79 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
--------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/term_merge_manager/term_merge_manager.info.yml
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------
8 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
----------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/term_merge_manager/README.md
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
26 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/term_merge_manager/src/Form/TermMergeFromForm.php
-------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-------------------------------------------------------------------------------------
19 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
22 | WARNING | [ ] Unused variable $entity.
-------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/term_merge_manager/src/Form/TermMergeIntoSettingsForm.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: /var/www/html/modules/contrib/term_merge_manager/src/Form/TermMergeFromSettingsForm.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: /var/www/html/modules/contrib/term_merge_manager/src/Form/TermMergeIntoForm.php
-------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-------------------------------------------------------------------------------------
19 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
22 | WARNING | [ ] Unused variable $entity.
-------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/term_merge_manager/src/Form/TermMergeIntoDeleteForm.php
-------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-------------------------------------------------------------------------------------------
20 | ERROR | [x] Expected 1 blank line before function; 0 found
30 | ERROR | [x] Expected 1 blank line after function; 0 found
31 | ERROR | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/term_merge_manager/src/Entity/TermMergeFromViewsData.php
--------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
--------------------------------------------------------------------------------------------
19 | WARNING | [x] There must be no blank line following an inline comment
19 | WARNING | [ ] There must be no blank line following an inline comment
--------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/term_merge_manager/src/Entity/TermMergeIntoInterface.php
--------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------------------
16 | WARNING | There must be no blank line following an inline comment
51 | WARNING | Line exceeds 80 characters; contains 85 characters
--------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/term_merge_manager/src/Entity/TermMergeFrom.php
---------------------------------------------------------------------------------------------------------------------------------
FOUND 12 ERRORS AND 3 WARNINGS AFFECTING 8 LINES
---------------------------------------------------------------------------------------------------------------------------------
72 | ERROR | [ ] Missing parameter comment
73 | ERROR | [ ] Missing parameter comment
74 | ERROR | [x] Separate the @param and @return sections by a blank line.
74 | ERROR | [ ] Description for the @return value is missing
94 | ERROR | [ ] Missing parameter comment
95 | ERROR | [x] Separate the @param and @return sections by a blank line.
95 | ERROR | [ ] Description for the @return value is missing
126 | ERROR | [x] Missing function doc comment
138 | ERROR | [x] Missing function doc comment
297 | WARNING | [x] 'todo add constraint' should match the format '@todo Fix problem X here.'
297 | WARNING | [x] There must be no blank line following an inline comment
297 | WARNING | [ ] There must be no blank line following an inline comment
297 | ERROR | [x] 2 spaces found before inline comment; expected "// todo add constraint" but found "// todo add constraint"
297 | ERROR | [x] Inline comments must start with a capital letter
297 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
---------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/term_merge_manager/src/Entity/TermMergeFromInterface.php
--------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------------------
16 | WARNING | There must be no blank line following an inline comment
70 | WARNING | Line exceeds 80 characters; contains 85 characters
--------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/term_merge_manager/src/Entity/TermMergeIntoViewsData.php
--------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
--------------------------------------------------------------------------------------------
19 | WARNING | [x] There must be no blank line following an inline comment
19 | WARNING | [ ] There must be no blank line following an inline comment
--------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/term_merge_manager/src/Entity/TermMergeInto.php
-----------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------
68 | ERROR | [x] Missing function doc comment
-----------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/term_merge_manager/src/TermMergeFromListBuilder.php
---------------------------------------------------------------------------------------
FOUND 7 ERRORS AND 1 WARNING AFFECTING 7 LINES
---------------------------------------------------------------------------------------
16 | ERROR | [x] Missing function doc comment
34 | ERROR | [x] Short array syntax must be used to define arrays
40 | ERROR | [x] Short array syntax must be used to define arrays
46 | ERROR | [x] Short array syntax must be used to define arrays
52 | ERROR | [x] Short array syntax must be used to define arrays
64 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
69 | ERROR | [x] Concat operator must be surrounded by a single space
69 | ERROR | [x] Concat operator must be surrounded by a single space
---------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/term_merge_manager/src/TermMergeIntoListBuilder.php
---------------------------------------------------------------------------------------
FOUND 7 ERRORS AND 1 WARNING AFFECTING 6 LINES
---------------------------------------------------------------------------------------
16 | ERROR | [x] Missing function doc comment
34 | ERROR | [x] Short array syntax must be used to define arrays
40 | ERROR | [x] Short array syntax must be used to define arrays
46 | ERROR | [x] Short array syntax must be used to define arrays
58 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
62 | ERROR | [x] Concat operator must be surrounded by a single space
62 | ERROR | [x] Concat operator must be surrounded by a single space
62 | ERROR | [x] Concat operator must be surrounded by a single space
---------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/term_merge_manager/src/EventSubscriber/DefaultSubscriber.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 9 ERRORS AND 6 WARNINGS AFFECTING 13 LINES
------------------------------------------------------------------------------------------------------------------------------
13 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
27 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
29 | ERROR | [ ] Missing parameter comment
31 | ERROR | [ ] Public method name "DefaultSubscriber::term_merge_merge_action" is not in lowerCamel format
48 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
56 | WARNING | [ ] Unused variable $index.
70 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
73 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
79 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
79 | ERROR | [x] Concat operator must be surrounded by a single space
80 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
80 | ERROR | [x] Concat operator must be surrounded by a single space
90 | ERROR | [x] Concat operator must be surrounded by a single space
98 | ERROR | [x] Expected 1 blank line after function; 0 found
99 | ERROR | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------

Time: 2.35 secs; Memory: 6MB

Steps to reproduce

Run following command

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

Proposed resolution

Above error/warnings need to be fixed.

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇮🇳India samit.310@gmail.com

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.71.5 2024