Coding Standard Issue

Created on 28 February 2023, almost 2 years ago

Problem/Motivation

FILE: ...upal/web/modules/contrib/type_style/tests/src/Functional/TypeStyleTest.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 46 | WARNING | t() calls should be avoided in classes, use
    |         | \Drupal\Core\StringTranslation\StringTranslationTrait and
    |         | $this->t() instead
--------------------------------------------------------------------------------


FILE: ...al/web/modules/contrib/type_style/src/TwigExtension/TypeStyleExtension.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 28 | ERROR | The array declaration extends to column 123 (the limit is 80).
    |       | The array content should be split up over multiple lines
--------------------------------------------------------------------------------


FILE: ...w/html/drupal_9.4/drupal/web/modules/contrib/type_style/type_style.api.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------
  1 | ERROR | [x] Missing file doc comment
  3 | ERROR | [x] There must be one blank line after the last USE statement; 0
    |       |     found;
 33 | ERROR | [x] Use null coalesce operator instead of ternary operator.
--------------------------------------------------------------------------------

Time: 1.93 secs; Memory: 10MB
📌 Task
Status

Needs review

Version

1.0

Component

Code

Created by

🇮🇳India Rohit Rana

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Rohit Rana
  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • 🇮🇳India nayana_mvr

    Verified the patch #2 on Drupal version 10.1.x and Type Style version 8.x-1.x.
    Command used is Vendor/bin/phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml modules/contrib/type_style

    Patch applied cleanly but there are few more errors.

    FILE: .../contrib/type_style/type_style.module
    ------------------------------------------------------------------------------------------------
    FOUND 5 ERRORS AFFECTING 4 LINES
    ------------------------------------------------------------------------------------------------
      49 | ERROR | [ ] Type hint "array" missing for &$form
      49 | ERROR | [ ] Type hint "array" missing for $settings
      62 | ERROR | [x] Use null coalesce operator instead of ternary operator.
      68 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     126 | ERROR | [x] Use null coalesce operator instead of ternary operator.
    ------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------
    
    
    FILE: .../contrib/type_style/modules/type_style_moderation/type_style_moderation.install
    ------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------------------
     4 | ERROR | [x] Doc comment short description must be on the first line
    ------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: .../contrib/type_style/modules/type_style_moderation/type_style_moderation.info.yml
    -------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    -------------------------------------------------------------------------------------------------------------------------------------------
     1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
     9 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
    -------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: .../contrib/type_style/modules/type_style_moderation/type_style_moderation.module
    -----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 5 ERRORS AFFECTING 5 LINES
    -----------------------------------------------------------------------------------------------------------------------------------------
       4 | ERROR | [x] Doc comment short description must be on the first line
      30 | ERROR | [x] Use null coalesce operator instead of ternary operator.
      61 | ERROR | [x] Use null coalesce operator instead of ternary operator.
      99 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     131 | ERROR | [x] Use null coalesce operator instead of ternary operator.
    -----------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------------------
  • @nayana_mvr opened merge request.
  • 🇮🇳India nayana_mvr

    I just tried to fix the remaining issues and created the MR!1 with all the changes. Please review.
    Thanks.

Production build 0.71.5 2024