Fix the issues reported by phpcs

Created on 23 March 2023, over 1 year ago
Updated 22 August 2024, 3 months ago

Running phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,css,info,yml,md --report-width=79 reports the following errors/warnings which should be fixed.

FILE: ./log_stdout/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 3 | WARNING | Line exceeds 80 characters; contains 111 characters
----------------------------------------------------------------------


FILE: ./log_stdout/log_stdout.links.menu.yml
--------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------
 6 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------


FILE: ./log_stdout/src/Logger/Stdout.php
-------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The first
   |       |     wrong one is Drupal\Core\Logger\RfcLogLevel.
-------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------

Time: 201ms; Memory: 10MB

 
 

šŸ“Œ Task
Status

RTBC

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India gayatri chahar

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 @gayatri chahar
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India gayatri chahar

    Patch created. Please review it

    Thanks

  • Assigned to hardikpandya
  • Status changed to Needs work over 1 year ago
  • šŸ‡®šŸ‡³India hardikpandya

    This would be part of phpcs fixes and a single ticket should be created to fix all phpcs issues rather than breaking it up. Updating the details and tags for this issue.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • šŸ‡®šŸ‡³India dineshkumarbollu

    Hi

    MR!4 found some issues.

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

    FILE: /var/www/html/drupalvb/web/modules/contrib/log_google_chat-3340484/src/Logger/GoogleChatLogMessageFormatter.php
    ---------------------------------------------------------------------------------------------------------------------------
    FOUND 6 ERRORS AND 2 WARNINGS AFFECTING 8 LINES
    ---------------------------------------------------------------------------------------------------------------------------
    58 | ERROR | Doc comment is empty
    61 | ERROR | Public method name "GoogleChatLogMessageFormatter::send_to_google_chat" is not in lowerCamel format
    76 | WARNING | Unused variable $result.
    81 | ERROR | Doc comment is empty
    84 | ERROR | Public method name "GoogleChatLogMessageFormatter::format_message_with_theme" is not in lowerCamel format
    92 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    105 | ERROR | Doc comment is empty
    108 | ERROR | Public method name "GoogleChatLogMessageFormatter::is_content_allowed" is not in lowerCamel format
    ---------------------------------------------------------------------------------------------------------------------------

    FILE: /var/www/html/drupalvb/web/modules/contrib/log_google_chat-3340484/log_google_chat.module
    ------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    ------------------------------------------------------------------------------------------------------
    20 | WARNING | Avoid backslash escaping in translatable strings when possible, use "" quotes instead
    41 | WARNING | Unused global variable $base_root.
    42 | WARNING | Unused variable $config.
    ------------------------------------------------------------------------------------------------------

    Time: 327ms; Memory: 12MB

    Thanks.

  • Status changed to Needs work over 1 year ago
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India hardikpandya

    Added core_version_requirement in the info file. The README file normally can have more than 80 characters and that warning could be ignored.

  • Status changed to Needs work 5 months ago
  • šŸ‡®šŸ‡³India dev16.addweb

    Need to fix below remaining phpcs issue

    modules/custom/log_stdout/
    
    FILE: /home/addweb/Drupal8-vagrant/web/web/contribution/drupal-9-3/web/modules/custom/log_stdout/src/Logger/Stdout.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Logger\RfcLogLevel.
    ------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/addweb/Drupal8-vagrant/web/web/contribution/drupal-9-3/web/modules/custom/log_stdout/README.md
    -----------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------
     3 | WARNING | Line exceeds 80 characters; contains 111 characters
    -----------------------------------------------------------------------------------------------------------
    
    Time: 91ms; Memory: 10MB
  • Status changed to Needs review 5 months ago
  • šŸ‡®šŸ‡³India dev16.addweb

    I have Fixed issues mention on #11, Please review.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    The 8.x-2.x branch is not supported, and it has not been updated since September 3, 2020, contrary to the 8.x-1.x branch which has been updated eight months ago.

  • šŸ‡®šŸ‡³India dev16.addweb

    Hi @apaderno, Should we check and create a new merge request against the 8.x-1.x branch?

  • Pipeline finished with Failed
    5 months ago
    Total: 40s
    #204679
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    apaderno ā†’ changed the visibility of the branch 3349806-fix-phpcs-warnings-errors to hidden.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    apaderno ā†’ changed the visibility of the branch 3349806-fix-php_codesniffer-warnings_errors to hidden.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    apaderno ā†’ changed the visibility of the branch 3349806-fix-php_codesniffer-warnings_errors to active.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    (Let's include the .md files.)

  • Status changed to RTBC 3 months ago
  • Hi @avpaderno,

    I have applied the commits made on MR!12, it was applied successfully and confirmed no errors reported remaining.

    āžœ  log_stdout git:(8.x-1.x) curl https://git.drupalcode.org/project/log_stdout/-/merge_requests/12.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2583    0  2583    0     0   7877      0 --:--:-- --:--:-- --:--:--  8174
    patching file README.md
    patching file log_stdout.links.menu.yml
    patching file src/Logger/Stdout.php
    āžœ  log_stdout git:(8.x-1.x) āœ— ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig log_stdout
    āžœ  contrib git:(master) āœ—

    Will now move this to RTBC

    Thanks,
    Jake

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    avpaderno ā†’ changed the visibility of the branch 3349806-fix-phpcs-issues to hidden.

  • Pipeline finished with Failed
    3 months ago
    Total: 43s
    #261186
  • Pipeline finished with Success
    3 months ago
    Total: 134s
    #261182
Production build 0.71.5 2024