Fix coding standard related errors

Created on 11 May 2016, almost 9 years ago
Updated 3 January 2024, over 1 year ago

When running the module through coder the following errors were shown

phpcs -s --standard=Drupal sites/default/modules/draggable_blocks/

FILE: .../drupal/sites/default/modules/draggable_blocks/src/Draggable.php
----------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------
  2 | ERROR   | [x] Namespaced classes, interfaces and traits should not
    |         |     begin with a file doc comment
    |         |     (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
 21 | ERROR   | [x] Expected 1 blank line before function; 2 found
    |         |     (Squiz.WhiteSpace.FunctionSpacing.Before)
 41 | WARNING | [ ] Line exceeds 80 characters; contains 105
    |         |     characters (Drupal.Files.LineLength.TooLong)
 56 | WARNING | [ ] Line exceeds 80 characters; contains 112
    |         |     characters (Drupal.Files.LineLength.TooLong)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...default/modules/draggable_blocks/src/Plugin/Block/AdminBlock.php
----------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 5 LINES
----------------------------------------------------------------------
  2 | ERROR | [x] Namespaced classes, interfaces and traits should not
    |       |     begin with a file doc comment
    |       |     (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
  3 | ERROR | [x] Doc comment short description must end with a full
    |       |     stop (Drupal.Commenting.DocComment.ShortFullStop)
 15 | ERROR | [x] Missing class doc comment
    |       |     (Drupal.Commenting.ClassComment.Missing)
 19 | ERROR | [x] Expected 1 blank line before function; 0 found
    |       |     (Squiz.WhiteSpace.FunctionSpacing.Before)
 27 | ERROR | [x] Expected 1 newline at end of file; 0 found
    |       |     (Drupal.Files.EndFileNewline.NoneFound)
 27 | ERROR | [x] A closing tag is not permitted at the end of a PHP
    |       |     file (Zend.Files.ClosingTag.NotAllowed)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: .../modules/draggable_blocks/src/Plugin/Draggable/DraggableBase.php
----------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------
  3 | ERROR   | [x] Namespaced classes, interfaces and traits should not
    |         |     begin with a file doc comment
    |         |     (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
 10 | WARNING | [x] Unused use statement
    |         |     (Drupal.Classes.UnusedUseStatement.UnusedUse)
 12 | WARNING | [x] Unused use statement
    |         |     (Drupal.Classes.UnusedUseStatement.UnusedUse)
 19 | ERROR   | [ ] Missing short description in doc comment
    |         |     (Drupal.Commenting.DocComment.MissingShort)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...ault/modules/draggable_blocks/src/Plugin/Draggable/Draggable.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 3 | ERROR | [x] Namespaced classes, interfaces and traits should not
   |       |     begin with a file doc comment
   |       |     (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...draggable_blocks/src/Plugin/Draggable/DraggablePluginManager.php
----------------------------------------------------------------------
FOUND 4 ERRORS AND 1 WARNING AFFECTING 4 LINES
----------------------------------------------------------------------
  3 | ERROR   | [x] Namespaced classes, interfaces and traits should not
    |         |     begin with a file doc comment
    |         |     (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
 47 | ERROR   | [x] No space found before comment text; expected "//
    |         |     dpm($discovery);" but found "//dpm($discovery);"
    |         |     (Drupal.Commenting.InlineComment.NoSpaceBefore)
 48 | WARNING | [ ] Line exceeds 80 characters; contains 91
    |         |     characters (Drupal.Files.LineLength.TooLong)
 48 | ERROR   | [x] No space found before comment text; expected "//
    |         |     dpm($module_handler->getModuleDirectories() +
    |         |     $theme_handler->getThemeDirectories());" but found
    |         |     "//dpm($module_handler->getModuleDirectories() +
    |         |     $theme_handler->getThemeDirectories());"
    |         |     (Drupal.Commenting.InlineComment.NoSpaceBefore)
 51 | ERROR   | [x] Whitespace found at end of line
    |         |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ..._blocks/src/Plugin/Draggable/DraggablePluginManagerInterface.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
  2 | ERROR | [x] Namespaced classes, interfaces and traits should not
    |       |     begin with a file doc comment
    |       |     (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
 22 | ERROR | [x] Additional blank lines found at end of doc comment
    |       |     (Drupal.Commenting.DocComment.SpacingAfter)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...les/draggable_blocks/src/Plugin/Draggable/DraggableInterface.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 3 | ERROR | [x] Namespaced classes, interfaces and traits should not
   |       |     begin with a file doc comment
   |       |     (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...al/sites/default/modules/draggable_blocks/src/Form/AdminForm.php
----------------------------------------------------------------------
FOUND 12 ERRORS AND 1 WARNING AFFECTING 12 LINES
----------------------------------------------------------------------
  3 | ERROR   | [x] Namespaced classes, interfaces and traits should not
    |         |     begin with a file doc comment
    |         |     (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
 13 | ERROR   | [x] Missing class doc comment
    |         |     (Drupal.Commenting.ClassComment.Missing)
 14 | ERROR   | [x] Whitespace found at end of line
    |         |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 16 | ERROR   | [ ] Doc comment short description must start with a
    |         |     capital letter
    |         |     (Drupal.Commenting.DocComment.ShortNotCapital)
 21 | ERROR   | [x] Whitespace found at end of line
    |         |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 23 | ERROR   | [ ] Doc comment short description must start with a
    |         |     capital letter
    |         |     (Drupal.Commenting.DocComment.ShortNotCapital)
 33 | WARNING | [x] A comma should follow the last multiline array item.
    |         |     Found: ) (Drupal.Array.Array.CommaLastItem)
 44 | ERROR   | [x] Whitespace found at end of line
    |         |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 47 | ERROR   | [x] Whitespace found at end of line
    |         |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 56 | ERROR   | [ ] Private method name
    |         |     "AdminForm::_draggable_blocks_cancel_submit" is not in
    |         |     lowerCamel format
    |         |     (Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps)
 56 | ERROR   | [x] Missing function doc comment
    |         |     (Drupal.Commenting.FunctionComment.Missing)
 57 | ERROR   | [x] Concat operator must be surrounded by a single
    |         |     space
    |         |     (Squiz.Strings.ConcatenationSpacing.PaddingFound)
 60 | ERROR   | [x] Expected 1 newline at end of file; 0 found
    |         |     (Drupal.Files.EndFileNewline.NoneFound)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...es/default/modules/draggable_blocks/src/Annotation/Draggable.php
----------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
----------------------------------------------------------------------
  3 | ERROR   | [x] Namespaced classes, interfaces and traits should not
    |         |     begin with a file doc comment
    |         |     (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
 95 | WARNING | [ ] Line exceeds 80 characters; contains 83
    |         |     characters (Drupal.Files.LineLength.TooLong)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: .../sites/default/modules/draggable_blocks/css/draggable_blocks.css
----------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 5 LINES
----------------------------------------------------------------------
  5 | ERROR | [x] Expected 1 space after colon in style definition; 0
    |       |     found (Squiz.CSS.ColonSpacing.NoneAfter)
  5 | ERROR | [x] CSS colours must be defined in lowercase; expected
    |       |     #fafafa but found #FAFAFA
    |       |     (Drupal.CSS.ColourDefinition.NotLower)
  9 | ERROR | [x] Expected 1 space after colon in style definition; 0
    |       |     found (Squiz.CSS.ColonSpacing.NoneAfter)
 39 | ERROR | [x] Whitespace found at end of line
    |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 52 | ERROR | [x] Whitespace found at end of line
    |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 65 | ERROR | [x] CSS colours must be defined in lowercase; expected
    |       |     #c0c0c0 but found #C0C0C0
    |       |     (Drupal.CSS.ColourDefinition.NotLower)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...al/sites/default/modules/draggable_blocks/js/draggable_blocks.js
----------------------------------------------------------------------
FOUND 53 ERRORS AFFECTING 26 LINES
----------------------------------------------------------------------
  1 | ERROR | [x] You must use "/**" style comments for a file
    |       |     comment (Drupal.Commenting.FileComment.WrongStyle)
 16 | ERROR | [x] Inline comments must end in full-stops, exclamation
    |       |     marks, colons, question marks, or closing parentheses
    |       |     (Drupal.Commenting.InlineComment.InvalidEndChar)
 17 | ERROR | [x] There should be no white space after an opening "("
    |       |     (Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace)
 17 | ERROR | [x] There should be no white space before a closing ")"
    |       |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
 24 | ERROR | [x] Expected 0 spaces before opening parenthesis; 1
    |       |     found
    |       |     (Squiz.Functions.MultiLineFunctionDeclaration.SpaceBeforeOpenParen)
 38 | ERROR | [x] Expected 1 space after IF keyword; 0 found
    |       |     (Drupal.ControlStructures.ControlSignature.SpaceAfterKeyword)
 38 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
    |       |     (Drupal.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis)
 43 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
    |       |     (Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction)
 52 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
    |       |     (Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction)
 52 | ERROR | [x] There should be no white space after an opening "("
    |       |     (Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace)
 52 | ERROR | [x] There should be no white space before a closing ")"
    |       |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
 56 | ERROR | [x] There should be no white space after an opening "("
    |       |     (Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace)
 56 | ERROR | [x] There should be no white space before a closing ")"
    |       |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
 56 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
    |       |     (Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction)
 56 | ERROR | [x] There should be no white space after an opening "("
    |       |     (Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace)
 56 | ERROR | [x] There should be no white space before a closing ")"
    |       |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
 59 | ERROR | [x] Inline comments must end in full-stops, exclamation
    |       |     marks, colons, question marks, or closing parentheses
    |       |     (Drupal.Commenting.InlineComment.InvalidEndChar)
 64 | ERROR | [x] There should be no white space after an opening "("
    |       |     (Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace)
 64 | ERROR | [x] There should be no white space before a closing ")"
    |       |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
 65 | ERROR | [x] Inline comments must end in full-stops, exclamation
    |       |     marks, colons, question marks, or closing parentheses
    |       |     (Drupal.Commenting.InlineComment.InvalidEndChar)
 67 | ERROR | [x] Spaces must be used to indent lines; tabs are not
    |       |     allowed (Generic.WhiteSpace.DisallowTabIndent.TabsUsed)
 67 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found
    |       |     3 (Drupal.WhiteSpace.ScopeIndent.IncorrectExact)
 67 | ERROR | [x] Closing brace indented incorrectly; expected 6 spaces,
    |       |     found 3 (Drupal.WhiteSpace.ScopeClosingBrace.Indent)
 68 | ERROR | [x] Inline comments must end in full-stops, exclamation
    |       |     marks, colons, question marks, or closing parentheses
    |       |     (Drupal.Commenting.InlineComment.InvalidEndChar)
 70 | ERROR | [x] There should be no white space after an opening "("
    |       |     (Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace)
 70 | ERROR | [x] There should be no white space before a closing ")"
    |       |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
 72 | ERROR | [x] There should be no white space after an opening "("
    |       |     (Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace)
 72 | ERROR | [x] There should be no white space before a closing ")"
    |       |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
 80 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
    |       |     (Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction)
 80 | ERROR | [x] There should be no white space after an opening "("
    |       |     (Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace)
 80 | ERROR | [x] There should be no white space before a closing ")"
    |       |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
 85 | ERROR | [x] There should be no white space after an opening "("
    |       |     (Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace)
 85 | ERROR | [x] There should be no white space before a closing ")"
    |       |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
 86 | ERROR | [x] There should be no white space after an opening "("
    |       |     (Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace)
 86 | ERROR | [x] There should be no white space before a closing ")"
    |       |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
 87 | ERROR | [x] There should be no white space after an opening "("
    |       |     (Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace)
 87 | ERROR | [x] There should be no white space before a closing ")"
    |       |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
 88 | ERROR | [x] There should be no white space after an opening "("
    |       |     (Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace)
 88 | ERROR | [x] There should be no white space before a closing ")"
    |       |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
 89 | ERROR | [x] Whitespace found at end of line
    |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 90 | ERROR | [x] There should be no white space after an opening "("
    |       |     (Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace)
 90 | ERROR | [x] There should be no white space before a closing ")"
    |       |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
 90 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
    |       |     (Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction)
 91 | ERROR | [x] There should be no white space after an opening "("
    |       |     (Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace)
 91 | ERROR | [x] There should be no white space before a closing ")"
    |       |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
 92 | ERROR | [x] There should be no white space after an opening "("
    |       |     (Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace)
 92 | ERROR | [x] There should be no white space before a closing ")"
    |       |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
 93 | ERROR | [x] There should be no white space after an opening "("
    |       |     (Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace)
 93 | ERROR | [x] There should be no white space before a closing ")"
    |       |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
 93 | ERROR | [x] There should be no white space after an opening "("
    |       |     (Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace)
 93 | ERROR | [x] There should be no white space before a closing ")"
    |       |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
 96 | ERROR | [x] There should be no white space after an opening "("
    |       |     (Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace)
 96 | ERROR | [x] There should be no white space before a closing ")"
    |       |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 53 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
📌 Task
Status

Needs work

Version

1.0

Component

Code

Created by

🇺🇸United States anoopjohn Washington D. C.

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

Comments & Activities

Not all content is available!

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

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    +/**
    + * Implements draggable_blocks_control().
    + */
     function _draggable_blocks_control() {

    That is not a hook implementation. That means the documentation comment must be different.

     /**
    - * hook_page_attachments_alter()
    + * Hook_page_attachments_alter()
      */
     function draggable_blocks_page_attachments_alter(array &$page) {

    That is not how a hook implementation is documented.

     /**
    - * template_preprocess_theme()
    + * Template_preprocess_theme()
      */
     function template_preprocess_draggable_blocks(array &$variables) {

    That is not the correct documentation comment either.

    -    // ToDo reemplazar la función de arriba
    -//  $variables['#attached']['library'][] = 'core/modernizr';
    +  // @todo reemplazar la función de arriba

    What follow @todo must be an English sentence.

    -function _draggable_blocks_enable_block ($definition, $weight, $region, $theme) {
    +/**
    + * Implements draggable_blocks_enable_block().
    + */
    +function _draggable_blocks_enable_block($definition, $weight, $region, $theme) {

    That is not a hook implementation. The documentation comment must document the parameters and the return value.

    -   * @var string optional
    +   * @var stringoptional

    stringoptional is not a PHP type.

    -   *
    -   * @deprecated
    -   *   Use \Drupal\draggable_blocks\Plugin\Draggable\DraggablePluginManagerInterface::getLayoutOptions().

    Basing on what is @deprecated removed?

    +/**
    + * Admin form for the module.
    + */
     class AdminForm extends FormBase {

    That short description is too generic.

  • First commit to issue fork.
Production build 0.71.5 2024