Fix the PHP_CodeSniffer issues reported by GitLab CI

Created on 16 May 2024, 7 months ago
Updated 18 July 2024, 5 months ago

-------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
-------------------------------------------------------------------------------------------------------
177 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
313 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
314 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
326 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
327 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-------------------------------------------------------------------------------------------------------

🐛 Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

🇮🇳India dev16.addweb

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 @dev16.addweb
  • First commit to issue fork.
  • 🇮🇳India riddhi.addweb

    Tested the Patch "fixed_phpcs_issues.patch" and it applied cleanly, but errors are still unresolved.

    FILE: /var/www/html/web/drupal10/web/modules/contrib/widget/src/Plugin/Block/WidgetBlock.php
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 26 ERRORS AND 2 WARNINGS AFFECTING 26 LINES
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
      18 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Block\BlockBase.
      36 | ERROR   | [x] There must be exactly one newline after the class comment
      43 | ERROR   | [ ] Missing short description in doc comment
      48 | ERROR   | [ ] Missing short description in doc comment
      53 | ERROR   | [ ] Missing short description in doc comment
      58 | ERROR   | [ ] Missing short description in doc comment
      63 | ERROR   | [ ] Missing short description in doc comment
     150 | ERROR   | [ ] Missing parameter comment
     152 | ERROR   | [ ] Description for the @return value is missing
     177 | WARNING | [x] '@todo: Remove Workaround for https://www.drupal.org/node/2798261.' should match the format '@todo Fix problem X here.'
     198 | ERROR   | [x] No space found before comment text; expected "// if ($definition['type'] == 'partial') {" but found "//if ($definition['type'] == 'partial') {"
     198 | ERROR   | [x] Inline comments must start with a capital letter
     198 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
     199 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
     200 | ERROR   | [x] No space found before comment text; expected "// }" but found "//}"
     230 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
     241 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
     258 | ERROR   | [ ] Missing short description in doc comment
     285 | ERROR   | [ ] Public method name "WidgetBlock::widgetBlockAJAXCallback" is not in lowerCamel format
     289 | ERROR   | [ ] Missing short description in doc comment
     290 | ERROR   | [ ] Description for the @return value is missing
     302 | ERROR   | [ ] Description for the @return value is missing
     309 | ERROR   | [x] Expected newline after closing brace
     319 | ERROR   | [ ] Missing short description in doc comment
     320 | ERROR   | [ ] Description for the @return value is missing
     367 | ERROR   | [ ] Comment indentation error, expected only 1 spaces
     386 | ERROR   | [x] Expected 1 blank line after function; 2 found
     393 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 12 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
  • Merge request !3Issue #3447512 - Fix the phpcs issues → (Open) created by vinmayiswamy
  • 🇮🇳India vinmayiswamy

    Hi, I created an MR to fix the phpcs issues reported but it seems like we don't have GitLab pipeline for this project. So I have downloaded the patch from MR and attaching here..

    Kindly please review.

    Thanks!

  • Status changed to RTBC 5 months ago
  • 🇮🇳India riddhi.addweb

    The mentioned page issue is resolved, & I have also checked and it is working as expected. I am attaching the Screenshots & doing RTBC for the same.

Production build 0.71.5 2024