Drupal Coding Standards Issues | phpcs

Created on 9 January 2023, about 2 years ago
Updated 26 March 2023, almost 2 years ago

Problem/Motivation

Getting following errors and warnings on running phpcs

FILE: .../contrib/search_api_autocomplete/css/search_api_autocomplete.css
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
14 | ERROR | [x] CSS colours must be defined in lowercase; expected
| | #0072b9 but found #0072B9
15 | ERROR | [x] CSS colours must be defined in lowercase; expected
| | #fff but found #FFF
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...contrib/search_api_autocomplete/search_api_autocomplete.info.yml
----------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
----------------------------------------------------------------------
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
----------------------------------------------------------------------

FILE: ...s/contrib/search_api_autocomplete/search_api_autocomplete.module
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
125 | WARNING | Unused variable $filter_name.
133 | WARNING | Unused variable $element.
----------------------------------------------------------------------

FILE: ...rib/search_api_autocomplete/src/AutocompleteBackendInterface.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
5 | WARNING | The url ' https://www.drupal.org/node/3256202 .' should
| | not end with a period.
----------------------------------------------------------------------

FILE: ...earch_api_autocomplete/src/Controller/AutocompleteController.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
91 | ERROR | [x] list(...) is forbidden, use [...] instead.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...pp/modules/contrib/search_api_autocomplete/src/Entity/Search.php
----------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------
110 | ERROR | [ ] The @var tag must be the first tag in a member
| | variable comment
150 | ERROR | [ ] The @var tag must be the first tag in a member
| | variable comment
368 | ERROR | [x] Use null coalesce operator instead of ternary
| | operator.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...les/contrib/search_api_autocomplete/src/Entity/SearchStorage.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
24 | ERROR | Comment indentation error, expected only 1 spaces
----------------------------------------------------------------------

FILE: ...ules/contrib/search_api_autocomplete/src/Form/SearchEditForm.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
162 | ERROR | [ ] The array declaration extends to column 426 (the
| | limit is 80). The array content should be split up
| | over multiple lines
229 | ERROR | [x] list(...) is forbidden, use [...] instead.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...autocomplete/src/Plugin/search_api_autocomplete/search/Views.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
146 | WARNING | Exceptions should not be translated
----------------------------------------------------------------------

FILE: ...ete/src/Plugin/search_api_autocomplete/suggester/LiveResults.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
424 | WARNING | Unused variable $bundle.
----------------------------------------------------------------------

FILE: ...ntrib/search_api_autocomplete/src/Utility/AutocompleteHelper.php
----------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
----------------------------------------------------------------------
32 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
79 | ERROR | The array declaration extends to column 113 (the
| | limit is 80). The array content should be split up
| | over multiple lines
----------------------------------------------------------------------

FILE: ...les/contrib/search_api_autocomplete/src/Utility/PluginHelper.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
87 | WARNING | Line exceeds 80 characters; contains 81 characters
----------------------------------------------------------------------

FILE: ...ib/search_api_autocomplete/src/Utility/PluginHelperInterface.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
58 | WARNING | Line exceeds 80 characters; contains 81 characters
----------------------------------------------------------------------

FILE: ...search_api_autocomplete_test/core/custom_autocomplete_script.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
25 | ERROR | The $_GET super global must not be accessed directly;
| | inject the request_stack service and use
| | $stack->getCurrentRequest()->query instead
----------------------------------------------------------------------

FILE: ...arch_api_autocomplete_test/search_api_autocomplete_test.info.yml
----------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
----------------------------------------------------------------------
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
----------------------------------------------------------------------

FILE: ...ocomplete_test_hooks/search_api_autocomplete_test_hooks.info.yml
----------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
----------------------------------------------------------------------
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
----------------------------------------------------------------------

FILE: ...ocomplete_test_pages/search_api_autocomplete_test_pages.info.yml
----------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
----------------------------------------------------------------------
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
----------------------------------------------------------------------

FILE: ..._api_autocomplete/tests/src/Functional/CacheInvalidationTest.php
----------------------------------------------------------------------
FOUND 6 ERRORS AND 14 WARNINGS AFFECTING 14 LINES
----------------------------------------------------------------------
51 | ERROR | [ ] Comment indentation error, expected only 1
| | spaces
52 | WARNING | [x] There must be no blank line following an inline
| | comment
52 | WARNING | [ ] There must be no blank line following an inline
| | comment
87 | WARNING | [x] There must be no blank line following an inline
| | comment
87 | WARNING | [ ] There must be no blank line following an inline
| | comment
107 | ERROR | [ ] Comment indentation error, expected only 1
| | spaces
112 | ERROR | [ ] Comment indentation error, expected only 3
| | spaces
113 | ERROR | [ ] Comment indentation error, expected only 5
| | spaces
117 | ERROR | [ ] Comment indentation error, expected only 3
| | spaces
120 | WARNING | [x] There must be no blank line following an inline
| | comment
120 | WARNING | [ ] There must be no blank line following an inline
| | comment
129 | WARNING | [ ] Line exceeds 80 characters; contains 131
| | characters
130 | WARNING | [ ] Line exceeds 80 characters; contains 106
| | characters
130 | WARNING | [x] There must be no blank line following an inline
| | comment
130 | WARNING | [ ] There must be no blank line following an inline
| | comment
139 | ERROR | [ ] Comment indentation error, expected only 1
| | spaces
141 | WARNING | [x] There must be no blank line following an inline
| | comment
141 | WARNING | [ ] There must be no blank line following an inline
| | comment
149 | WARNING | [ ] Line exceeds 80 characters; contains 131
| | characters
150 | WARNING | [ ] Line exceeds 80 characters; contains 110
| | characters
----------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ..._autocomplete/tests/src/FunctionalJavascript/IntegrationTest.php
----------------------------------------------------------------------
FOUND 3 ERRORS AND 2 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------
259 | ERROR | [x] list(...) is forbidden, use [...] instead.
285 | ERROR | [x] list(...) is forbidden, use [...] instead.
529 | WARNING | [ ] Unused variable $user_type.
534 | WARNING | [ ] Unused variable $label.
595 | ERROR | [x] Each PHP statement must be on a line by itself
----------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...ocomplete/tests/src/FunctionalJavascript/IntegrationTestBase.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
129 | ERROR | [x] Each PHP statement must be on a line by itself
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...complete/tests/src/FunctionalJavascript/PagesIntegrationTest.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
206 | ERROR | [x] list(...) is forbidden, use [...] instead.
222 | ERROR | [x] list(...) is forbidden, use [...] instead.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...s/contrib/search_api_autocomplete/tests/src/Kernel/ViewsTest.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
102 | ERROR | [x] Use null coalesce operator instead of ternary
| | operator.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...earch_api_autocomplete/tests/src/Unit/AutocompleteHelperTest.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 1 LINE
----------------------------------------------------------------------
45 | ERROR | The array declaration extends to column 84 (the limit
| | is 80). The array content should be split up over
| | multiple lines
45 | ERROR | The array declaration extends to column 83 (the limit
| | is 80). The array content should be split up over
| | multiple lines
----------------------------------------------------------------------

Time: 4.35 secs; Memory: 16MB

Steps to reproduce

Run the below command:

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

Proposed resolution

Do the required changes

🐛 Bug report
Status

Closed: won't fix

Version

1.7

Component

General code

Created by

🇮🇳India shivam-kumar

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024