Fix the issues reported by phpcs

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

Problem/Motivation

PHPCS reports the following:

C:\xampp\htdocs\backendassignment\web\modules\contrib>phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig hook_post_action

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\hook_post_action\hook_post_action.api.php
-----------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 3 WARNINGS AFFECTING 5 LINES
-----------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
  16 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
  30 | WARNING | [ ] Only string literals should be passed to t() where possible
 130 | WARNING | [ ] Only string literals should be passed to t() where possible
 199 | ERROR   | [x] Whitespace found at end of line
-----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\hook_post_action\hook_post_action.module
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 1 WARNING AFFECTING 4 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
 25 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements
    |         |     hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
 25 | ERROR   | [x] Doc comment short description must end with a full stop
 34 | ERROR   | [x] Data types in @param tags need to be fully namespaced
 55 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\hook_post_action\hook_post_action_example\hook_post_action_example.module
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
-------------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
 112 | ERROR | [x] Case breaking statements must be followed by a single blank line
 114 | ERROR | [x] Case breaking statements must be followed by a single blank line
 116 | ERROR | [x] Case breaking statements must be followed by a single blank line
-------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\hook_post_action\README.txt
---------------------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
---------------------------------------------------------------------------------------
  2 | WARNING | [ ] Line exceeds 80 characters; contains 107 characters
  4 | WARNING | [ ] Line exceeds 80 characters; contains 121 characters
 21 | WARNING | [ ] Line exceeds 80 characters; contains 105 characters
 26 | ERROR   | [x] Expected 1 newline at end of file; 0 found
---------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------

Time: 1.02 secs; Memory: 6MB

Steps to reproduce

Run the phpcs command on the module.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

RTBC

Version

1.0

Component

Code

Created by

🇮🇳India sidharth_soman Bangalore

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