Fix Drupal coding standard and Drupal Practice

Created on 26 August 2021, about 3 years ago
Updated 15 July 2024, 2 months ago
Whitespace found at end of line
(Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)

Unused use statement
(Drupal.Classes.UnusedUseStatement.UnusedUse)

There must be no blank line following an inline comment
(Drupal.Commenting.InlineComment.SpacingAfter)

Expected 1 space after IF keyword; 0 found
(Drupal.ControlStructures.ControlSignature.SpaceAfterKeyword)

No space found before comment text; expected "// '#description' => $this->t("Server Url.")," but found "//'#description' => $this->t("Server Url."),"
(Drupal.Commenting.InlineComment.NoSpaceBefore)

Array indentation error, expected 10 spaces but found 8
(Drupal.Arrays.Array.ArrayIndentation)

Expected 1 space after FOREACH keyword; 0 found
(Drupal.ControlStructures.ControlSignature.SpaceAfterKeyword)

There must be exactly one newline after the class comment
(Drupal.Commenting.ClassComment.SpacingAfter)

Short array syntax must be used to define arrays
(Drupal.Arrays.DisallowLongArraySyntax.Found)

The PHP open tag must be followed by exactly one blank line
(Drupal.WhiteSpace.OpenTagNewline.BlankLine)

A comma should follow the last multiline array item. Found: '

'
(Drupal.Arrays.Array.CommaLastItem)

TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
(Generic.PHP.UpperCaseConstant.Found)

🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇮🇳India omrmankar Mumbai, Maharashtra

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India riddhi.addweb

    I tried to apply the patch in 9.5x and it had applied cleanly, but after applying the patch the error is not resolved. Let me know if I can test this in any different version.

    FILE: /var/www/html/web/Drupal_9.5/web/modules/contrib/view_api_response/src/Controller/ViewApiResponseController.php
    --------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 4 WARNINGS AFFECTING 5 LINES
    --------------------------------------------------------------------------------------------------------------------------------
      6 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Serialization\Json.
     18 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
     23 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
     28 | WARNING | [ ] Unused variable $enable_status.
     45 | WARNING | [ ] Unused variable $username.
    --------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/Drupal_9.5/web/modules/contrib/view_api_response/src/ApiTypeListBuilder.php
    -------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\Entity\ConfigEntityListBuilder.
    -------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/Drupal_9.5/web/modules/contrib/view_api_response/src/Form/ApiTypeDeleteForm.php
    -----------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
    -----------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/Drupal_9.5/web/modules/contrib/view_api_response/src/Form/ApiTypeForm.php
    ---------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
    ---------------------------------------------------------------------------------------------------------------------------
       6 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\EntityForm.
      83 | WARNING | [ ] #options values usually have to run through t() for translation
     198 | WARNING | [ ] Vocabulary::loadMultiple calls should be avoided in classes, use dependency injection instead
    ---------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/Drupal_9.5/web/modules/contrib/view_api_response/src/ApiCall.php
    ----------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------
     16 | WARNING | Unused variable $code.
    ----------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/Drupal_9.5/web/modules/contrib/view_api_response/README.txt
    -----------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    -----------------------------------------------------------------------------------
     29 | WARNING | Line exceeds 80 characters; contains 87 characters
     32 | WARNING | Line exceeds 80 characters; contains 104 characters
    -----------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/Drupal_9.5/web/modules/contrib/view_api_response/view_api_response.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
    -------------------------------------------------------------------------------------------------------------
    
Production build 0.71.5 2024