Fix the warnings/errors reported by PHP_CodeSniffer

Created on 5 July 2023, over 1 year ago
Updated 11 September 2023, over 1 year ago

Problem/Motivation

FILE: /home/lenovo/druapl7to9/web/modules/contrib/twig_backlink/src/TwigBacklinkTwigExtension.php
-------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 16 ERRORS AND 6 WARNINGS AFFECTING 17 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line
   2 | WARNING | [x] There must be no blank line following an inline comment
   2 | WARNING | [ ] There must be no blank line following an inline comment
   2 | ERROR   | [ ] Namespaced classes, interfaces and traits should not begin with a file doc comment
   2 | ERROR   | [x] No space found before comment text; expected "// #Drush auto-generate all file" but found "//#Drush auto-generate all file"
   6 | ERROR   | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
  17 | ERROR   | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
  85 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 105 | WARNING | [ ] Node::load calls should be avoided in classes, use dependency injection instead
 112 | WARNING | [x] A comma should follow the last multiline array item. Found: )
 133 | ERROR   | [ ] Description for the @return value is missing
 140 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 145 | ERROR   | [x] Expected 1 blank line after function; 0 found
 146 | ERROR   | [x] The closing brace for the class must have an empty line before it
 152 | ERROR   | [ ] Description for the @return value is missing
 154 | ERROR   | [x] Expected 1 blank line before function; 2 found
 154 | ERROR   | [x] Incorrect spacing between argument "$order" and equals sign; expected 1 but found 0
 154 | ERROR   | [x] Incorrect spacing between default value and equals sign for argument "$order"; expected 1 but found 0
 155 | ERROR   | [x] Short array syntax must be used to define arrays
 156 | ERROR   | [x] Short array syntax must be used to define arrays
 157 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 168 | ERROR   | [x] Expected newline after closing brace
-------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 14 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/druapl7to9/web/modules/contrib/twig_backlink/src/Form/TwigBacklinkConfigurationForm.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------
 42 | ERROR   | [x] No space found before comment text; expected "// '#required' => TRUE," but found "//'#required' => TRUE,"
 55 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/druapl7to9/web/modules/contrib/twig_backlink/README.md
-------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
-------------------------------------------------------------------------
  2 | WARNING | [ ] Line exceeds 80 characters; contains 155 characters
  9 | WARNING | [ ] Line exceeds 80 characters; contains 129 characters
 13 | ERROR   | [x] Expected 1 newline at end of file; 2 found
-------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------


FILE: /home/lenovo/druapl7to9/web/modules/contrib/twig_backlink/twig_backlink.module
------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------------
 22 | ERROR   | [x] Concat operator must be surrounded by a single space
 23 | WARNING | [ ] Do not concatenate strings to translatable strings, they should be part of the t() argument and you should use placeholders
------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------

Time: 82ms; Memory: 10MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig twig_backline/

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Needs review

Version

2.0

Component

Code

Created by

🇮🇳India roshni27

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

Production build 0.71.5 2024