Problem/Motivation
When running the module code against Drupal coding standards based on Drupal standard, the module shows errors
Report:
FILE: /home/contribution/drupal/web/modules/contrib/chat_ai/README.md
-------------------------------------------------------------------------
FOUND 1 ERROR AND 15 WARNINGS AFFECTING 16 LINES
-------------------------------------------------------------------------
2 | WARNING | [ ] Line exceeds 80 characters; contains 98 characters
4 | WARNING | [ ] Line exceeds 80 characters; contains 160 characters
6 | WARNING | [ ] Line exceeds 80 characters; contains 128 characters
8 | WARNING | [ ] Line exceeds 80 characters; contains 167 characters
12 | WARNING | [ ] Line exceeds 80 characters; contains 353 characters
14 | WARNING | [ ] Line exceeds 80 characters; contains 137 characters
16 | WARNING | [ ] Line exceeds 80 characters; contains 193 characters
18 | WARNING | [ ] Line exceeds 80 characters; contains 138 characters
20 | WARNING | [ ] Line exceeds 80 characters; contains 219 characters
22 | WARNING | [ ] Line exceeds 80 characters; contains 371 characters
32 | WARNING | [ ] Line exceeds 80 characters; contains 161 characters
76 | WARNING | [ ] Line exceeds 80 characters; contains 105 characters
86 | WARNING | [ ] Line exceeds 80 characters; contains 229 characters
95 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
100 | WARNING | [ ] Line exceeds 80 characters; contains 165 characters
108 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------
FILE: /home/contribution/drupal/web/modules/contrib/chat_ai/src/ChatAI.php
---------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 5 WARNINGS AFFECTING 9 LINES
---------------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
66 | ERROR | [ ] Parameter $supabase is not described in comment
79 | ERROR | [ ] Doc comment for parameter $supabase, does not match actual variable name $config_factory
105 | ERROR | [ ] Description for the @return value is missing
113 | WARNING | [ ] Line exceeds 80 characters; contains 87 characters
126 | WARNING | [ ] Line exceeds 80 characters; contains 83 characters
167 | WARNING | [ ] Line exceeds 80 characters; contains 108 characters
207 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
227 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
---------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------
FILE: /home/contribution/drupal/web/modules/contrib/chat_ai/src/Form/SettingsForm.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\chat_ai\Http\OpenAiClientFactory.
91 | WARNING | [ ] Possible useless method overriding detected
------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------
FILE: /home/contribution/drupal/web/modules/contrib/chat_ai/src/Form/EmbeddingsForm.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 8 WARNINGS AFFECTING 12 LINES
-----------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\ConfigFormBase.
119 | WARNING | [ ] Node::load calls should be avoided in classes, use dependency injection instead
120 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
121 | WARNING | [ ] The use of function dpm() is discouraged
237 | WARNING | [ ] Possible useless method overriding detected
316 | ERROR | [ ] Description for the @return value must be on the next line
331 | WARNING | [ ] Unused variable $langcode.
354 | WARNING | [ ] Line exceeds 80 characters; contains 108 characters
356 | ERROR | [ ] Description for the @return value must be on the next line
371 | ERROR | [ ] Doc comment is empty
404 | WARNING | [ ] Line exceeds 80 characters; contains 88 characters
442 | WARNING | [ ] Line exceeds 80 characters; contains 87 characters
-----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------
FILE: /home/contribution/drupal/web/modules/contrib/chat_ai/src/Form/ChatBlockForm.php
---------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 8 WARNINGS AFFECTING 10 LINES
---------------------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Ajax\AjaxResponse.
19 | ERROR | [ ] Missing member variable doc comment
102 | WARNING | [ ] Possible useless method overriding detected
129 | WARNING | [ ] Line exceeds 80 characters; contains 227 characters
131 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
132 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
139 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
145 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
147 | WARNING | [ ] Line exceeds 80 characters; contains 88 characters
148 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------
FILE: /home/contribution/drupal/web/modules/contrib/chat_ai/src/Plugin/Block/ChatAIBlock.php
---------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------
22 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------
FILE: /home/contribution/drupal/web/modules/contrib/chat_ai/src/Embeddings.php
---------------------------------------------------------------------------------------------------------------------------------------
FOUND 18 ERRORS AND 19 WARNINGS AFFECTING 36 LINES
---------------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
79 | ERROR | [ ] Parameter $supabase is not described in comment
92 | ERROR | [ ] Doc comment for parameter $supabase, does not match actual variable name $config_factory
116 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
123 | ERROR | [ ] Description for the @return value must be on the next line
129 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
138 | WARNING | [ ] Line exceeds 80 characters; contains 101 characters
147 | WARNING | [ ] Line exceeds 80 characters; contains 91 characters
149 | ERROR | [ ] Description for the @return value must be on the next line
178 | ERROR | [ ] Description for the @return value must be on the next line
207 | WARNING | [ ] Line exceeds 80 characters; contains 83 characters
228 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
266 | WARNING | [ ] Line exceeds 80 characters; contains 84 characters
281 | WARNING | [ ] Unused variable $results.
294 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
305 | ERROR | [ ] Parameter $value is not described in comment
311 | ERROR | [ ] Description for the @return value must be on the next line
314 | WARNING | [ ] '@todo' should match the format '@todo Fix problem X here.'
328 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
337 | ERROR | [ ] Description for the @return value must be on the next line
340 | WARNING | [ ] '@todo' should match the format '@todo Fix problem X here.'
360 | ERROR | [ ] Description for the @return value must be on the next line
363 | WARNING | [ ] '@todo' should match the format '@todo Fix problem X here.'
378 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
378 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
380 | ERROR | [ ] Missing parameter comment
391 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
409 | ERROR | [ ] Description for the @return value must be on the next line
421 | ERROR | [ ] Parameter $value is not described in comment
427 | ERROR | [ ] Description for the @return value must be on the next line
430 | WARNING | [ ] '@todo' should match the format '@todo Fix problem X here.'
446 | ERROR | [ ] Description for the @return value must be on the next line
455 | WARNING | [ ] Line exceeds 80 characters; contains 94 characters
476 | ERROR | [ ] Missing parameter comment
478 | ERROR | [ ] Description for the @return value is missing
485 | WARNING | [ ] '@todo' should match the format '@todo Fix problem X here.'
520 | WARNING | [ ] Line exceeds 80 characters; contains 86 characters
---------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------
FILE: /home/contribution/drupal/web/modules/contrib/chat_ai/src/Supabase.php
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 4 WARNINGS AFFECTING 8 LINES
-------------------------------------------------------------------------------------------------------------------------------------
10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\chat_ai\Http\OpenAiClientFactory.
110 | ERROR | [ ] Description for the @return value is missing
123 | WARNING | [ ] Unused variable $body.
133 | WARNING | [ ] Line exceeds 80 characters; contains 102 characters
142 | ERROR | [ ] Description for the @return value must be on the next line
183 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
219 | WARNING | [ ] Line exceeds 80 characters; contains 86 characters
228 | ERROR | [ ] Description for the @return value must be on the next line
-------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------
FILE: /home/contribution/drupal/web/modules/contrib/chat_ai/src/Http/SupabaseClientFactory.php
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
-----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------
FILE: /home/contribution/drupal/web/modules/contrib/chat_ai/chat_ai.install
----------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
----------------------------------------------------------------------------
11 | ERROR | Empty installation hooks are not necessary
12 | WARNING | '@todo' should match the format '@todo Fix problem X here.'
19 | WARNING | '@todo' should match the format '@todo Fix problem X here.'
----------------------------------------------------------------------------
FILE: /home/contribution/drupal/web/modules/contrib/chat_ai/chat_ai.libraries.yml
----------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------
11 | ERROR | [x] Expected 1 newline at end of file; 2 found
----------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------
Steps to reproduce
Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig chat_ai/