Fix the issues reported by phpcs

Created on 17 May 2023, about 1 year ago
Updated 27 February 2024, 4 months ago

Problem/Motivation

vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig web/modules/contrib/language_suggestion/

FILE: ...ml/vbd9/web/modules/contrib/language_suggestion/language_suggestion.module
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...ontrib/language_suggestion/src/Controller/LanguageSuggestionController.php
--------------------------------------------------------------------------------
FOUND 11 ERRORS AND 4 WARNINGS AFFECTING 13 LINES
--------------------------------------------------------------------------------
16 | ERROR | [x] Missing class doc comment
18 | ERROR | [ ] Class property $config_factory should use lowerCamel naming
| | without underscores
18 | ERROR | [ ] Missing member variable doc comment
20 | ERROR | [x] Missing function doc comment
24 | ERROR | [x] Missing function doc comment
33 | ERROR | [ ] Public method name
| | "LanguageSuggestionController::getHTTPHeaderValue" is not
| | in lowerCamel format
45 | WARNING | [x] A comma should follow the last multiline array item. Found:
| | 'ip'
57 | WARNING | [ ] Unused variable $langcode.
62 | WARNING | [ ] File::load calls should be avoided in classes, use
| | dependency injection instead
73 | ERROR | [x] Use "elseif" in place of "else if"
75 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE"
| | but found "false"
76 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE"
| | but found "false"
76 | ERROR | [x] Whitespace found at end of line
81 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
83 | ERROR | [x] There should be no white space after an opening "["
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...les/contrib/language_suggestion/src/Form/LanguageSuggestionMappingForm.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AND 1 WARNING AFFECTING 4 LINES
--------------------------------------------------------------------------------
17 | ERROR | [x] Whitespace found at end of line
25 | ERROR | [ ] Parameter $language_manager is not described in comment
26 | WARNING | [ ] Line exceeds 80 characters; contains 88 characters
30 | ERROR | [ ] Doc comment for parameter $languageManager does not match
| | actual variable name $language_manager
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...es/contrib/language_suggestion/src/Form/LanguageSuggestionSettingsForm.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
183 | WARNING | File::load calls should be avoided in classes, use dependency
| | injection instead
--------------------------------------------------------------------------------

FILE: ...modules/contrib/language_suggestion/src/Form/NegotiationHTTPHeaderForm.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
8 | WARNING | [x] Unused use statement
73 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
74 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...d9/web/modules/contrib/language_suggestion/language_suggestion.routing.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
27 | WARNING | Open page callback found, please add a comment before the line
| | why there is no access restriction
35 | WARNING | Open page callback found, please add a comment before the line
| | why there is no access restriction
--------------------------------------------------------------------------------

FILE: ...ontrib/language_suggestion/tests/src/Functional/LanguageSuggestionTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
31 | ERROR | The array declaration extends to column 106 (the limit is 80).
| | The array content should be split up over multiple lines
--------------------------------------------------------------------------------

FILE: ...bd9/web/modules/contrib/language_suggestion/assets/language_suggestion.css
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
13 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 5
14 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 10
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vbd9/web/modules/contrib/language_suggestion/README.md
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
--------------------------------------------------------------------------
3 | WARNING | Line exceeds 80 characters; contains 150 characters
19 | WARNING | Line exceeds 80 characters; contains 265 characters
21 | WARNING | Line exceeds 80 characters; contains 428 characters
23 | WARNING | Line exceeds 80 characters; contains 147 characters
--------------------------------------------------------------------------

Time: 832ms; Memory: 12MB

Steps to reproduce

Proposed resolution

Run:

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

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Needs work

Version

1.0

Component

Code

Created by

🇮🇳India dineshkumarbollu

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