Fix the issues reported by phpcs

Created on 26 June 2023, about 1 year ago
Updated 7 June 2024, 21 days ago

Problem/Motivation

FILE: /var/www/html/vb/d_cont/openai_client/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 8 WARNINGS AFFECTING 8 LINES
----------------------------------------------------------------------
3 | WARNING | Line exceeds 80 characters; contains 279 characters
5 | WARNING | Line exceeds 80 characters; contains 82 characters
21 | WARNING | Line exceeds 80 characters; contains 252 characters
27 | WARNING | Line exceeds 80 characters; contains 139 characters
29 | WARNING | Line exceeds 80 characters; contains 129 characters
37 | WARNING | Line exceeds 80 characters; contains 82 characters
79 | WARNING | Line exceeds 80 characters; contains 99 characters
85 | WARNING | Line exceeds 80 characters; contains 100 characters
----------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/openai_client/query.txt
--------------------------------------------------------------------------------
FOUND 77 ERRORS AND 1 WARNING AFFECTING 34 LINES
--------------------------------------------------------------------------------
1 | WARNING | [ ] Line exceeds 80 characters; contains 133 characters
58 | ERROR | [ ] Missing short description in doc comment
63 | ERROR | [ ] Missing short description in doc comment
68 | ERROR | [ ] Parameter $api is not described in comment
68 | ERROR | [ ] Parameter $dateFormatter is not described in comment
121 | ERROR | [x] Expected newline after closing brace
133 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
139 | ERROR | [x] Concat operator must be surrounded by a single space
139 | ERROR | [x] Short array syntax must be used to define arrays
152 | ERROR | [x] Concat operator must be surrounded by a single space
152 | ERROR | [ ] The array declaration extends to column 91 (the limit is
| | 80). The array content should be split up over multiple
| | lines
153 | ERROR | [x] Concat operator must be surrounded by a single space
153 | ERROR | [ ] The array declaration extends to column 98 (the limit is
| | 80). The array content should be split up over multiple
| | lines
154 | ERROR | [x] Concat operator must be surrounded by a single space
154 | ERROR | [ ] The array declaration extends to column 106 (the limit is
| | 80). The array content should be split up over multiple
| | lines
156 | ERROR | [x] Concat operator must be surrounded by a single space
156 | ERROR | [ ] The array declaration extends to column 135 (the limit is
| | 80). The array content should be split up over multiple
| | lines
157 | ERROR | [x] Concat operator must be surrounded by a single space
157 | ERROR | [ ] The array declaration extends to column 110 (the limit is
| | 80). The array content should be split up over multiple
| | lines
158 | ERROR | [x] Concat operator must be surrounded by a single space
158 | ERROR | [ ] The array declaration extends to column 102 (the limit is
| | 80). The array content should be split up over multiple
| | lines
184 | ERROR | [x] Expected newline after closing brace
211 | ERROR | [x] Expected 1 space after "=="; 0 found
211 | ERROR | [x] Expected 1 space before ">"; 0 found
211 | ERROR | [x] Concat operator must be surrounded by a single space
211 | ERROR | [x] Expected 1 space before "/"; 0 found
211 | ERROR | [x] Expected 1 space after "/"; 0 found
211 | ERROR | [x] Expected 1 space before "/"; 0 found
211 | ERROR | [x] Expected 1 space after "/"; 0 found
211 | ERROR | [x] Concat operator must be surrounded by a single space
211 | ERROR | [x] Expected 1 space after "<="; 0 found
211 | ERROR | [x] Expected 1 space before "="; 0 found
212 | ERROR | [x] Expected 1 space after "<"; 0 found
212 | ERROR | [x] Expected 1 space before "?"; 0 found
212 | ERROR | [x] Expected 1 space after "?"; 0 found
219 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be
| | referenced with use statements
267 | ERROR | [ ] Description for the @return value is missing
279 | ERROR | [ ] Description for the @return value is missing
289 | ERROR | [ ] Description for the @return value is missing
295 | ERROR | [x] Missing function doc comment
309 | ERROR | [ ] Description for the @return value is missing
319 | ERROR | [ ] Description for the @return value is missing
324 | ERROR | [x] Expected 1 blank line after function; 0 found
325 | ERROR | [x] The closing brace for the class must have an empty line
| | before it
327 | ERROR | [x] Expected 1 space after "=="; 0 found
327 | ERROR | [x] Expected 1 space before ">"; 0 found
327 | ERROR | [x] Concat operator must be surrounded by a single space
327 | ERROR | [x] Expected 1 space before "/"; 0 found
327 | ERROR | [x] Expected 1 space after "/"; 0 found
327 | ERROR | [x] Concat operator must be surrounded by a single space
327 | ERROR | [x] Concat operator must be surrounded by a single space
327 | ERROR | [x] Expected 1 space after "<="; 0 found
327 | ERROR | [x] Expected 1 space before "="; 0 found
331 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
| | but found "true"
333 | ERROR | [x] Expected 1 space after "=="; 0 found
333 | ERROR | [x] Expected 1 space before ">"; 0 found
333 | ERROR | [x] Concat operator must be surrounded by a single space
333 | ERROR | [x] Expected 1 space before "/"; 0 found
333 | ERROR | [x] Expected 1 space after "/"; 0 found
333 | ERROR | [x] Concat operator must be surrounded by a single space
333 | ERROR | [x] Expected 1 space after "<="; 0 found
333 | ERROR | [x] Expected 1 space before "="; 0 found
335 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 4
335 | ERROR | [x] Expected 1 space before ":"; 0 found
342 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 8
346 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 8
350 | ERROR | [x] Expected 1 space after "=="; 0 found
350 | ERROR | [x] Expected 1 space before ">"; 0 found
350 | ERROR | [x] Concat operator must be surrounded by a single space
350 | ERROR | [x] Expected 1 space before "/"; 0 found
350 | ERROR | [x] Expected 1 space after "/"; 0 found
350 | ERROR | [x] Concat operator must be surrounded by a single space
350 | ERROR | [x] Concat operator must be surrounded by a single space
350 | ERROR | [x] Expected 1 space after "<="; 0 found
350 | ERROR | [x] Expected 1 space before "="; 0 found
353 | ERROR | [x] Concat operator must be surrounded by a single space
355 | ERROR | [x] Expected 1 space after "^"; 0 found
355 | ERROR | [x] Expected 1 space after "^"; 0 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 62 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/openai_client/openai_client.module
--------------------------------------------------------------------------------
FOUND 26 ERRORS AND 2 WARNINGS AFFECTING 21 LINES
--------------------------------------------------------------------------------
16 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements
| | hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "*
| | Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or
| | "* Implements hook_foo_BAR_ID_bar() for block templates."
18 | ERROR | [ ] Missing parameter comment
18 | ERROR | [ ] Missing parameter type
19 | ERROR | [ ] Missing parameter comment
20 | ERROR | [ ] Missing parameter comment
20 | ERROR | [ ] Missing parameter type
22 | ERROR | [ ] If there is no return value for a function, there must not
| | be a @return tag.
22 | ERROR | [ ] Description for the @return value is missing
30 | ERROR | [x] Case breaking statements must be followed by a single
| | blank line
42 | ERROR | [x] Concat operator must be surrounded by a single space
46 | ERROR | [x] Case breaking statements must be followed by a single
| | blank line
49 | ERROR | [x] Case breaking statements must be followed by a single
| | blank line
107 | ERROR | [ ] Missing parameter comment
108 | ERROR | [ ] Missing parameter comment
110 | ERROR | [ ] If there is no return value for a function, there must not
| | be a @return tag.
110 | ERROR | [ ] Description for the @return value is missing
111 | ERROR | [x] Separate the @return and @throws sections by a blank line.
118 | ERROR | [x] Inline comments must start with a capital letter
118 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
127 | ERROR | [x] Concat operator must be surrounded by a single space
152 | ERROR | [x] Expected newline after closing brace
162 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements
| | hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "*
| | Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or
| | "* Implements hook_foo_BAR_ID_bar() for block templates."
162 | ERROR | [x] Doc comment short description must end with a full stop
164 | ERROR | [ ] Missing parameter comment
165 | ERROR | [ ] Missing parameter comment
166 | ERROR | [ ] Missing parameter comment
168 | ERROR | [ ] If there is no return value for a function, there must not
| | be a @return tag.
168 | ERROR | [ ] Description for the @return value is missing
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/openai_client/src/OpenAIClientWrapper.php
--------------------------------------------------------------------------------
FOUND 14 ERRORS AND 1 WARNING AFFECTING 15 LINES
--------------------------------------------------------------------------------
8 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be
| | referenced with use statements
60 | ERROR | [x] Parameter comment must be on the next line
62 | ERROR | [ ] Description for the @return value is missing
74 | ERROR | [ ] Description for the @return value is missing
84 | ERROR | [ ] Description for the @return value is missing
93 | ERROR | [ ] Missing parameter comment
95 | ERROR | [ ] Description for the @return value is missing
107 | ERROR | [x] Expected newline after closing brace
116 | ERROR | [ ] Description for the @return value is missing
129 | WARNING | [ ] Line exceeds 80 characters; contains 99 characters
133 | ERROR | [ ] Description for the @return value must be on the next line
153 | ERROR | [ ] Description for the @return value is missing
166 | ERROR | [ ] Description for the @return value is missing
171 | ERROR | [x] Expected 1 blank line after function; 0 found
172 | ERROR | [x] The closing brace for the class must have an empty line
| | before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/openai_client/src/Form/CreateImageForm.php
--------------------------------------------------------------------------------
FOUND 14 ERRORS AND 1 WARNING AFFECTING 9 LINES
--------------------------------------------------------------------------------
15 | ERROR | [ ] Missing short description in doc comment
23 | ERROR | [ ] Missing parameter comment
54 | ERROR | [x] Concat operator must be surrounded by a single space
54 | ERROR | [x] Concat operator must be surrounded by a single space
97 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
97 | ERROR | [x] 4 spaces found before inline comment; expected "// if
| | (mb_strlen($form_state->getValue('message')) < 10) {" but
| | found "// if
| | (mb_strlen($form_state->getValue('message')) < 10) {"
97 | ERROR | [x] Inline comments must start with a capital letter
98 | WARNING | [ ] Line exceeds 80 characters; contains 102 characters
98 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
98 | ERROR | [ ] Comment indentation error, expected only 4 spaces
99 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
99 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
118 | ERROR | [x] Expected newline after closing brace
123 | ERROR | [x] Expected 1 blank line after function; 0 found
124 | ERROR | [x] The closing brace for the class must have an empty line
| | before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 11 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/openai_client/src/Form/SettingsForm.php
--------------------------------------------------------------------------------
FOUND 21 ERRORS AND 1 WARNING AFFECTING 14 LINES
--------------------------------------------------------------------------------
20 | ERROR | [ ] Missing short description in doc comment
25 | ERROR | [ ] Missing short description in doc comment
30 | ERROR | [ ] Parameter $api is not described in comment
30 | ERROR | [ ] Parameter $dateFormatter is not described in comment
108 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
129 | ERROR | [x] Expected newline after closing brace
141 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
147 | ERROR | [x] Concat operator must be surrounded by a single space
147 | ERROR | [x] Short array syntax must be used to define arrays
160 | ERROR | [x] Concat operator must be surrounded by a single space
160 | ERROR | [ ] The array declaration extends to column 91 (the limit is
| | 80). The array content should be split up over multiple
| | lines
161 | ERROR | [x] Concat operator must be surrounded by a single space
161 | ERROR | [ ] The array declaration extends to column 98 (the limit is
| | 80). The array content should be split up over multiple
| | lines
162 | ERROR | [x] Concat operator must be surrounded by a single space
162 | ERROR | [ ] The array declaration extends to column 106 (the limit is
| | 80). The array content should be split up over multiple
| | lines
164 | ERROR | [x] Concat operator must be surrounded by a single space
164 | ERROR | [ ] The array declaration extends to column 135 (the limit is
| | 80). The array content should be split up over multiple
| | lines
165 | ERROR | [x] Concat operator must be surrounded by a single space
165 | ERROR | [ ] The array declaration extends to column 110 (the limit is
| | 80). The array content should be split up over multiple
| | lines
166 | ERROR | [x] Concat operator must be surrounded by a single space
166 | ERROR | [ ] The array declaration extends to column 102 (the limit is
| | 80). The array content should be split up over multiple
| | lines
186 | ERROR | [x] Expected newline after closing brace
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 11 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/openai_client/openai_client.install
--------------------------------------------------------------------------------
FOUND 17 ERRORS AND 4 WARNINGS AFFECTING 18 LINES
--------------------------------------------------------------------------------
22 | ERROR | [x] No space found before comment text; expected "// /**" but
| | found "///**"
25 | ERROR | [x] No space found before comment text; expected "// function
| | openai_client_schema() {" but found "//function
| | openai_client_schema() {"
27 | ERROR | [ ] Comment indentation error, expected only 2 spaces
29 | ERROR | [ ] Comment indentation error, expected only 4 spaces
30 | ERROR | [ ] Comment indentation error, expected only 6 spaces
35 | ERROR | [ ] Comment indentation error, expected only 6 spaces
39 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
42 | ERROR | [ ] Comment indentation error, expected only 6 spaces
50 | ERROR | [ ] Comment indentation error, expected only 6 spaces
57 | ERROR | [ ] Comment indentation error, expected only 6 spaces
63 | ERROR | [ ] Comment indentation error, expected only 6 spaces
71 | ERROR | [ ] Comment indentation error, expected only 4 spaces
78 | WARNING | [x] There must be no blank line following an inline comment
78 | WARNING | [ ] There must be no blank line following an inline comment
78 | ERROR | [x] No space found before comment text; expected "// }" but
| | found "//}"
80 | ERROR | [x] No space found before comment text; expected "// /**" but
| | found "///**"
83 | ERROR | [x] No space found before comment text; expected "// function
| | openai_client_requirements($phase) {" but found "//function
| | openai_client_requirements($phase) {"
87 | ERROR | [ ] Comment indentation error, expected only 2 spaces
89 | ERROR | [ ] Comment indentation error, expected only 4 spaces
96 | WARNING | [ ] There must be no blank line following an inline comment
96 | ERROR | [x] No space found before comment text; expected "// }" but
| | found "//}"
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 190ms; Memory: 10MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig openai_client/

Remaining tasks

Patch/MR review

📌 Task
Status

Fixed

Version

1.1

Component

Code

Created by

🇮🇳India urvashi_vora Madhya Pradesh, India

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 @urvashi_vora
  • Status changed to Needs work about 1 year ago
  • 🇵🇭Philippines paraderojether

    Hi @urvashi_vora, I reviewed coding_standard_fixes.patch, and the patch is skipped or not successfully applied.

    Please check.
    Thank You.

  • 🇮🇳India Ashutosh Ahirwal India

    Providing updated patch.
    Some error remaining not sure about it.

  • Status changed to Needs review 12 months ago
  • 🇮🇳India urvashi_vora Madhya Pradesh, India

    Marking it to Needs Review, so that patch in #3 could be reviewed.

  • Status changed to Needs work 11 months ago
  • 🇵🇭Philippines clarkssquared

    Hi Ashutosh Ahirwal

    I applied your patch #3, I confirmed that it fixes most of the PHPCS issues and errors. However, there are still PHPCS errors remain in the module after applying your patch, for your convenience below is the said error

    FILE: /Users/studenttrainees/openai_client/openai_client.install
    ------------------------------------------------------------------------
    FOUND 13 ERRORS AND 2 WARNINGS AFFECTING 15 LINES
    ------------------------------------------------------------------------
     26 | ERROR   | Comment indentation error, expected only 1 spaces
     27 | ERROR   | Comment indentation error, expected only 2 spaces
     29 | ERROR   | Comment indentation error, expected only 4 spaces
     30 | ERROR   | Comment indentation error, expected only 6 spaces
     35 | ERROR   | Comment indentation error, expected only 6 spaces
     39 | WARNING | Line exceeds 80 characters; contains 81 characters
     42 | ERROR   | Comment indentation error, expected only 6 spaces
     50 | ERROR   | Comment indentation error, expected only 6 spaces
     57 | ERROR   | Comment indentation error, expected only 6 spaces
     63 | ERROR   | Comment indentation error, expected only 6 spaces
     71 | ERROR   | Comment indentation error, expected only 4 spaces
     83 | ERROR   | Comment indentation error, expected only 1 spaces
     86 | ERROR   | Comment indentation error, expected only 2 spaces
     88 | ERROR   | Comment indentation error, expected only 4 spaces
     95 | WARNING | There must be no blank line following an inline comment
    ------------------------------------------------------------------------
    
    Time: 496ms; Memory: 10MB
    
    

    Please also look at the screenshot I attached.

    Thank you

  • 🇮🇳India Ashutosh Ahirwal India

    Hi clarkssquared
    The error is showing because code is commented in install file and commented code is not indented correctly according to phpcs.
    Currently removed the commented code and providing a new patch.
    Need maintainers review too.
    Thanks.
    Please review.

  • Status changed to Needs review 9 months ago
  • 🇪🇸Spain psf_ Huelva

    Nice, thx for the job.

    The next time I will install PHPcs before publish code. I use it daily but when I created the module don't have it installed.

    If anyone want integrate PHPcs in DDEV, I writed this commands: https://gist.github.com/PSF1/aedf54d8a62e192e72c9de616ac6e04e

  • 🇪🇸Spain psf_ Huelva
  • 🇪🇸Spain psf_ Huelva

    Fixes code style in dev branch: https://git.drupalcode.org/project/openai_client/-/commit/f7d7f08fea1f7c...

    Please, if anyone can review it...

  • Status changed to Fixed 29 days ago
  • 🇪🇸Spain psf_ Huelva
  • Status changed to Fixed 21 days ago
  • 🇪🇸Spain psf_ Huelva
  • 🇪🇸Spain psf_ Huelva
Production build 0.69.0 2024