Fix Drupal Coding Standard Errors

Created on 25 February 2021, almost 4 years ago
Updated 2 November 2023, about 1 year ago

Problem/Motivation

There is a bunch of Drupal coding standard errors that need to be fixed. The Long array syntax errors are already handled in a separate issue => #2870562: Convert module to use short array syntax (new coding standard). .

Here is a list of coding standard errors except for Long array syntax errors within the module:

$ phpcs --standard=Drupal --exclude=Drupal.Arrays.DisallowLongArraySyntax .

FILE: /soundcloudfield/src/Tests/SoundCloudWidgetValidationTest.php
-------------------------------------------------------------------------------------------------------------------------------
FOUND 37 ERRORS AND 1 WARNING AFFECTING 30 LINES
-------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line
  11 | ERROR   | [x] Doc comment short description must end with a full stop
  17 | ERROR   | [x] Doc comment short description must end with a full stop
  25 | ERROR   | [x] Doc comment short description must end with a full stop
  26 | ERROR   | [ ] Missing @var tag in member variable comment
  43 | ERROR   | [x] Missing function doc comment
  46 | ERROR   | [x] Array indentation error, expected 6 spaces but found 49
  47 | ERROR   | [x] Array indentation error, expected 6 spaces but found 49
  48 | ERROR   | [x] Array indentation error, expected 6 spaces but found 49
  49 | ERROR   | [x] Array closing indentation error, expected 4 spaces but found 47
  53 | ERROR   | [x] Doc comment short description must end with a full stop
  55 | ERROR   | [x] Visibility must be declared on method "testSoundCloudUrlValid"
  75 | ERROR   | [x] Doc comment short description must end with a full stop
  77 | ERROR   | [x] Visibility must be declared on method "testSoundCloudUrlInvalid"
 132 | WARNING | [ ] Only string literals should be passed to t() where possible
 141 | ERROR   | [x] No space found before comment text; expected "// db field" but found "//db field"
 141 | ERROR   | [x] Inline comments must start with a capital letter
 141 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 143 | ERROR   | [x] Array indentation error, expected 6 spaces but found 55
 144 | ERROR   | [x] Array indentation error, expected 6 spaces but found 55
 145 | ERROR   | [x] Array indentation error, expected 6 spaces but found 55
 146 | ERROR   | [x] Array indentation error, expected 6 spaces but found 55
 147 | ERROR   | [x] Array closing indentation error, expected 4 spaces but found 53
 149 | ERROR   | [x] No space found before comment text; expected "// field type" but found "//field type"
 149 | ERROR   | [x] Inline comments must start with a capital letter
 149 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 151 | ERROR   | [x] Array indentation error, expected 6 spaces but found 41
 152 | ERROR   | [x] Array indentation error, expected 6 spaces but found 41
 153 | ERROR   | [x] Array indentation error, expected 6 spaces but found 41
 156 | ERROR   | [x] Array closing indentation error, expected 4 spaces but found 39
 159 | ERROR   | [x] No space found before comment text; expected "// form display" but found "//form display"
 159 | ERROR   | [x] Inline comments must start with a capital letter
 159 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 166 | ERROR   | [x] No space found before comment text; expected "// display" but found "//display"
 166 | ERROR   | [x] Inline comments must start with a capital letter
 166 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 186 | ERROR   | [x] Expected 1 blank line after function; 0 found
 187 | ERROR   | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------------------------------------------------


FILE: /soundcloudfield/src/Plugin/Field/FieldType/SoundCloudItem.php
--------------------------------------------------------------------------------------------------------------------------------------
FOUND 8 ERRORS AND 2 WARNINGS AFFECTING 6 LINES
--------------------------------------------------------------------------------------------------------------------------------------
  6 | WARNING | [x] Unused use statement
  8 | ERROR   | [x] Comments may not appear after statements
  8 | ERROR   | [x] Inline comments must start with a capital letter
  8 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 46 | ERROR   | [x] Line indented incorrectly; expected at least 6 spaces, found 0
 46 | ERROR   | [x] 8 spaces found before inline comment; expected "// 'indexes' => array(" but found "//        'indexes' => array("
 47 | ERROR   | [x] Line indented incorrectly; expected at least 6 spaces, found 0
 47 | ERROR   | [ ] Comment indentation error, expected only 8 spaces
 48 | ERROR   | [x] Line indented incorrectly; expected at least 6 spaces, found 0
 83 | WARNING | [x] A comma should follow the last multiline array item. Found: )
--------------------------------------------------------------------------------------------------------------------------------------


FILE: /soundcloudfield/src/Plugin/Field/FieldWidget/SoundCloudWidget.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
------------------------------------------------------------------------------------------------------------------------------
  6 | WARNING | [x] Unused use statement
 29 | WARNING | [x] There must be no blank line following an inline comment
 45 | ERROR   | [x] Comments may not appear after statements
 47 | ERROR   | [x] Comments may not appear after statements
 47 | ERROR   | [x] Inline comments must start with a capital letter
 47 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
------------------------------------------------------------------------------------------------------------------------------


FILE: /soundcloudfield/src/Plugin/Field/FieldFormatter/SoundCloudDefaultFormatter.php
-------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 9 ERRORS AFFECTING 7 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------
 176 | ERROR | [x] Blank comments are not allowed
 204 | ERROR | [x] Inline comments must start with a capital letter
 275 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 0
 275 | ERROR | [x] 6 spaces found before inline comment; expected "// $elements[$delta] = array(" but found "//      $elements[$delta] = array("
 276 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 0
 276 | ERROR | [ ] Comment indentation error, expected only 6 spaces
 277 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 0
 278 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 0
 284 | ERROR | [x] Missing function doc comment
-------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /soundcloudfield/src/Plugin/Field/FieldFormatter/SoundCloudLinkFormatter.php
----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------
 24 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
----------------------------------------------------------------------------------------------------------------------------------

Proposed resolution

The long array syntax errors has been handled in #2870562: Convert module to use short array syntax (new coding standard). . So, fix the rest of the errors as per Drupal coding standards in this issue.

User interface changes

NONE

API changes

NONE

Data model changes

NONE

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India ankithashetty Karnataka, India

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.

Production build 0.71.5 2024