Fix the issues reported by phpcs

Created on 29 June 2023, 12 months ago
Updated 4 June 2024, 20 days ago

Problem/Motivation

FILE: /home/system/Documents/contribution/tmgmt_openai-3371272/src/Plugin/tmgmt/Translator/OpenAiTranslator.php
---------------------------------------------------------------------------------------------------------------------
FOUND 13 ERRORS AND 2 WARNINGS AFFECTING 15 LINES
---------------------------------------------------------------------------------------------------------------------
 117 | WARNING | Line exceeds 80 characters; contains 85 characters
 129 | WARNING | Line exceeds 80 characters; contains 85 characters
 278 | ERROR   | Missing parameter comment
 279 | ERROR   | Missing parameter comment
 281 | ERROR   | Description for the @return value must be on the next line
 313 | ERROR   | Missing parameter comment
 314 | ERROR   | Missing parameter comment
 316 | ERROR   | Description for the @return value must be on the next line
 346 | ERROR   | Doc comment is empty
 362 | ERROR   | Doc comment is empty
 369 | ERROR   | Doc comment is empty
 379 | ERROR   | Description for the @return value must be on the next line
 394 | ERROR   | Doc comment short description must be on a single line, further text should be a separate paragraph
 407 | ERROR   | Doc comment short description must be on a single line, further text should be a separate paragraph
 445 | ERROR   | @throws tag comment must end with a full stop
---------------------------------------------------------------------------------------------------------------------

Time: 89ms; Memory: 12MB

Steps to reproduce

Run following command

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml tmgmt_openai/
📌 Task
Status

RTBC

Version

1.0

Component

Code

Created by

🇮🇳India Prachi6824

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

Merge Requests

Comments & Activities

  • Issue created by @Prachi6824
  • Assigned to Prachi6824
  • Status changed to Needs review 12 months ago
  • 🇮🇳India Prachi6824

    Hello,

    I have created a patch to solve all the errors related to phpcs within the module

    Please review and apply it .

  • Issue was unassigned.
  • Status changed to Needs work 12 months ago
  • 🇵🇭Philippines paraderojether

    Hi @prachi6824

    I reviewed patch #2 and there are still remaining issues reported by phpcs shown below:

    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig tmgmt_openai

    FILE: ...denttrainees/Drupal/drupalorg-issues-site/docroot/modules/contrib/tmgmt_openai/tmgmt_openai.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: /Users/studenttrainees/Drupal/drupalorg-issues-site/docroot/modules/contrib/tmgmt_openai/README.md
    --------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------
     47 | WARNING | Line exceeds 80 characters; contains 84 characters
    --------------------------------------------------------------------------------------------------------
    
    
    FILE: ...rainees/Drupal/drupalorg-issues-site/docroot/modules/contrib/tmgmt_openai/src/OpenAiTranslatorUi.php
    ----------------------------------------------------------------------------------------------------------
    FOUND 8 ERRORS AND 1 WARNING AFFECTING 9 LINES
    ----------------------------------------------------------------------------------------------------------
     15 | ERROR   | [ ] Missing @var tag in member variable comment
     20 | ERROR   | [x] Expected 1 space after "=>"; 0 found
     30 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
     42 | ERROR   | [x] Short array syntax must be used to define arrays
     52 | ERROR   | [x] Short array syntax must be used to define arrays
     59 | ERROR   | [x] Short array syntax must be used to define arrays
     69 | ERROR   | [x] Short array syntax must be used to define arrays
     80 | ERROR   | [x] Short array syntax must be used to define arrays
     94 | ERROR   | [x] Short array syntax must be used to define arrays
    ----------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------
    
    
    FILE: ...rg-issues-site/docroot/modules/contrib/tmgmt_openai/src/Plugin/tmgmt/Translator/OpenAiTranslator.php
    ----------------------------------------------------------------------------------------------------------
    FOUND 27 ERRORS AND 4 WARNINGS AFFECTING 30 LINES
    ----------------------------------------------------------------------------------------------------------
      16 | ERROR   | [x] When importing a class with "use", do not include a leading \
      45 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
      46 | ERROR   | [x] Expected 5 space(s) before asterisk; 3 found
      47 | ERROR   | [x] Expected 5 space(s) before asterisk; 3 found
      48 | ERROR   | [x] Expected 5 space(s) before asterisk; 3 found
      49 | ERROR   | [x] Expected 5 space(s) before asterisk; 3 found
      50 | ERROR   | [x] Expected 5 space(s) before asterisk; 3 found
      51 | ERROR   | [x] Expected 5 space(s) before asterisk; 3 found
      52 | ERROR   | [x] Expected 5 space(s) before asterisk; 3 found
      53 | ERROR   | [x] Expected 5 space(s) before asterisk; 3 found
      54 | ERROR   | [x] Expected 5 space(s) before asterisk; 3 found
      55 | ERROR   | [x] Expected 5 space(s) before asterisk; 3 found
      56 | ERROR   | [x] Expected 5 space(s) before asterisk; 3 found
      84 | WARNING | [x] A comma should follow the last multiline array item. Found: )
     101 | ERROR   | [x] Data types in @param tags need to be fully namespaced
     118 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
     130 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
     141 | ERROR   | [x] Short array syntax must be used to define arrays
     154 | ERROR   | [x] Data types in @param tags need to be fully namespaced
     157 | ERROR   | [x] Parameter comment must end with a full stop
     161 | WARNING | [ ] Line exceeds 80 characters; contains 84 characters
     163 | ERROR   | [ ] Return type "array object" must not contain spaces
     166 | ERROR   | [x] Data types in @throws tags need to be fully namespaced
     167 | ERROR   | [ ] @throws tag comment must end with a full stop
     171 | ERROR   | [x] Short array syntax must be used to define arrays
     171 | ERROR   | [x] Short array syntax must be used to define arrays
     173 | ERROR   | [x] Short array syntax must be used to define arrays
     188 | ERROR   | [ ] The array declaration extends to column 142 (the limit is 80). The array content
         |         |     should be split up over multiple lines
     190 | ERROR   | [x] Whitespace found at end of line
     233 | ERROR   | [x] Object operator not indented correctly; expected 10 spaces but found 12
     237 | ERROR   | [x] Short array syntax must be used to define arrays
    ----------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 25 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------
    
    Time: 438ms; Memory: 12MB

    Please check.
    Thank you.

  • Assigned to nitin_lama
  • 🇮🇳India nitin_lama

    Addressed #3, Updated patch.

    Errors/warning remaining are:
    I think we can ignore these warning. Please review.

  • Merge request !1#3371272 Fixing phpcs errors/warnings → (Open) created by nitin_lama
  • Status changed to Needs review 12 months ago
  • 🇮🇳India nitin_lama

    Created MR1 for the changes.

  • Issue was unassigned.
  • Status changed to Needs work 10 months ago
  • 🇹🇼Taiwan amourow

    The MR needs to rebase to the latest code.

  • 🇮🇳India kbk1992 Hyderabad

    bharath-kondeti made their first commit to this issue’s fork.

  • Status changed to Needs review 10 months ago
  • 🇮🇳India kbk1992 Hyderabad
  • Status changed to Needs work 10 months ago
  • First commit to issue fork.
  • 🇮🇳India sakthi_dev

    Addressed the unresolved comments partially.

  • 🇮🇳India zkhan.aamir

    Issue summary updated

  • Assigned to nitin_lama
  • 🇮🇳India nitin_lama

    Updated the IS for the remaining issues.

  • Issue was unassigned.
  • Venkatraman Ganesan made their first commit to this issue’s fork.

  • 🇮🇳India zkhan.aamir

    Hi,

    MR #19 applied successfully.

    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules/tmgmt_openai (1.0.x)
    $ curl https://git.drupalcode.org/project/tmgmt_openai/-/merge_requests/1.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  4127    0  4127    0     0   4848      0 --:--:-- --:--:-- --:--:--  4861
    patching file src/OpenAiTranslatorUi.php
    patching file src/Plugin/tmgmt/Translator/OpenAiTranslator.php
    patching file tmgmt_openai.install
    

    Still some errors remaining.

    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules
    $ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,js,yml tmgmt_openai/
    
    FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\tmgmt_openai\README.md
    -------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------
     47 | WARNING | Line exceeds 80 characters; contains 84 characters
    -------------------------------------------------------------------------------
    
    
    FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\tmgmt_openai\src\Plugin\tmgmt\Translator\OpenAiTranslator.php
    ----------------------------------------------------------------------------------------------------------------------
    FOUND 13 ERRORS AFFECTING 13 LINES
    ----------------------------------------------------------------------------------------------------------------------
     129 | ERROR | Missing parameter comment
     130 | ERROR | Missing parameter comment
     132 | ERROR | Description for the @return value must be on the next line
     164 | ERROR | Missing parameter comment
     165 | ERROR | Missing parameter comment
     167 | ERROR | Description for the @return value must be on the next line
     197 | ERROR | Doc comment is empty
     213 | ERROR | Doc comment is empty
     220 | ERROR | Doc comment is empty
     230 | ERROR | Description for the @return value must be on the next line
     245 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph
     258 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph
     296 | ERROR | @throws tag comment must end with a full stop
    ----------------------------------------------------------------------------------------------------------------------
    
    
    FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\tmgmt_openai\tmgmt_openai.info.yml
    ----------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------
     6 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
    ----------------------------------------------------------------------------------------------
    
    
    FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\tmgmt_openai\tmgmt_openai.install
    ------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------
     14 | WARNING | Line exceeds 80 characters; contains 119 characters
    ------------------------------------------------------------------------------------------
    
    Time: 331ms; Memory: 12MB
    
  • 🇮🇳India Anjali Mehta

    Anjali Mehta made their first commit to this issue’s fork.

  • First commit to issue fork.
  • 🇮🇳India Preethy_ray

    pray_12 made their first commit to this issue’s fork.

  • Status changed to Needs review 4 months ago
  • Status changed to Needs work 4 months ago
  • 🇮🇳India Shank115

    I ran phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml tmgmt_openai and found these errors:

    FILE: /home/sites/tmgmt_openai/src/Plugin/tmgmt/Translator/OpenAiTranslator.php
    -----------------------------------------------------------------------------------------------------------------------
    FOUND 19 ERRORS AFFECTING 17 LINES
    -----------------------------------------------------------------------------------------------------------------------
      37 | ERROR | [x] Additional blank lines found at end of doc comment
      43 | ERROR | [x] Additional blank lines found at end of doc comment
     131 | ERROR | [ ] Missing parameter comment
     132 | ERROR | [ ] Missing parameter comment
     133 | ERROR | [x] Separate the @param and @return sections by a blank line.
     133 | ERROR | [ ] Description for the @return value must be on the next line
     165 | ERROR | [ ] Missing parameter comment
     166 | ERROR | [ ] Missing parameter comment
     167 | ERROR | [x] Separate the @param and @return sections by a blank line.
     167 | ERROR | [ ] Description for the @return value must be on the next line
     197 | ERROR | [x] Missing function doc comment
     210 | ERROR | [x] Missing function doc comment
     214 | ERROR | [x] Missing function doc comment
     221 | ERROR | [ ] Description for the @return value must be on the next line
     236 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
     249 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
     276 | ERROR | [x] Parameter comment must end with a full stop
     287 | ERROR | [ ] @throws tag comment must end with a full stop
     415 | ERROR | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
    -----------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/sites/tmgmt_openai/src/OpenAiTranslatorUi.php
    -------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------
     16 | ERROR | [x] Do not append variable name "$models" to the type declaration in a member variable comment
    -------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/sites/tmgmt_openai/tmgmt_openai.install
    ------------------------------------------------------------------------------------------------------------------------------
    FOUND 7 ERRORS AND 2 WARNINGS AFFECTING 7 LINES
    ------------------------------------------------------------------------------------------------------------------------------
      3 | ERROR   | [x] The open comment tag must be the only content on the line
      4 | ERROR   | [x] The second line in the file doc comment must be "@file"
      4 | ERROR   | [x] Function comment short description must start with exactly one space
      5 | ERROR   | [ ] Wrong function doc comment end; expected "*/", found "**/"
      7 | WARNING | [x] Unused use statement
     11 | ERROR   | [x] There must be no blank lines after the function comment
     14 | ERROR   | [x] Opening brace should be on the same line as the declaration
     17 | WARNING | [ ] Line exceeds 80 characters; contains 118 characters
     17 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
    ------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/sites/tmgmt_openai/README.md
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
     47 | WARNING | Line exceeds 80 characters; contains 84 characters
    ----------------------------------------------------------------------
    
  • Shruu_rao made their first commit to this issue’s fork.

  • 🇮🇳India zkhan.aamir

    Hi,

    MR #26 applied successfully.

    $ curl https://git.drupalcode.org/project/tmgmt_openai/-/merge_requests/1.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  7516    0  7516    0     0  15117      0 --:--:-- --:--:-- --:--:-- 15153
    patching file README.md
    patching file src/OpenAiTranslatorUi.php
    patching file src/Plugin/tmgmt/Translator/OpenAiTranslator.php
    patching file tmgmt_openai.install
    

    Still some errors remaining.

    $ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml tmgmt_openai/
    
    FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\tmgmt_openai\src\Plugin\tmgmt\Translator\OpenAiTranslator.php
    ----------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    ----------------------------------------------------------------------------------------------------------------------
     255 | WARNING | Line exceeds 80 characters; contains 85 characters
     267 | WARNING | Line exceeds 80 characters; contains 85 characters
    ----------------------------------------------------------------------------------------------------------------------
    
    
    FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\tmgmt_openai\tmgmt_openai.info.yml
    ----------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------
     6 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
    ----------------------------------------------------------------------------------------------
    
    
    FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\tmgmt_openai\tmgmt_openai.install
    ------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------
     14 | WARNING | Line exceeds 80 characters; contains 119 characters
    ------------------------------------------------------------------------------------------
    
    Time: 333ms; Memory: 12MB
    
    
  • 🇮🇳India sakthi_dev

    Couldn't find any issues. Please refer the screenshot.

  • Arijit Acharya made their first commit to this issue’s fork.

  • I encountered some of the warnings, listing them below. I also created a MR to fix them.
    Sorry there has been a type in creating the branch, the issue id anyhow got missed in the branch name while creating the branch. It was not intensional, I regret for it.
    Kindly review and merge.

    FILE: ...app/web/modules/custom/tmgmt_openai-3371272/tmgmt_openai.install
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
     14 | WARNING | Line exceeds 80 characters; contains 119 characters
    ----------------------------------------------------------------------
    
    
    FILE: ...pp/web/modules/custom/tmgmt_openai-3371272/tmgmt_openai.info.yml
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
     6 | WARNING | All dependencies must be prefixed with the project
       |         | name, for example "drupal:"
    ----------------------------------------------------------------------
    
    
    FILE: ..._openai-3371272/src/Plugin/tmgmt/Translator/OpenAiTranslator.php
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    ----------------------------------------------------------------------
     255 | WARNING | Line exceeds 80 characters; contains 85 characters
     267 | WARNING | Line exceeds 80 characters; contains 85 characters
    ----------------------------------------------------------------------
    
  • Status changed to Needs review 20 days ago
  • 🇵🇭Philippines paraderojether

    Hi

    I reviewed MR!10, and confirmed it fixes the issues reported by phpcs.

    tmgmt_openai curl https://git.drupalcode.org/project/tmgmt_openai/-/merge_requests/10.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  7849    0  7849    0     0  24386      0 --:--:-- --:--:-- --:--:-- 24917
    patching file README.md
    patching file 'src/OpenAiTranslatorUi.php'
    patching file 'src/Plugin/tmgmt/Translator/OpenAiTranslator.php'
    patching file tmgmt_openai.info.yml
    patching file tmgmt_openai.install
    ➜  tmgmt_openai cd ..
    ➜  contrib phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig tmgmt_openai
    ➜  contrib

    Moving this to RBTC.
    Thank you.

  • Status changed to RTBC 20 days ago
Production build 0.69.0 2024