PHPCS issues in module file.

Created on 11 July 2023, over 1 year ago
Updated 2 December 2023, 12 months ago

Problem/Motivation

PHPCS reports the following errors in the module file:

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\user_view_mode\user_view_mode.module
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 24 ERRORS AND 4 WARNINGS AFFECTING 20 LINES
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
 10 | WARNING | [x] Unused use statement
 11 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Routing\RouteMatchInterface.
 13 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 1
 14 | ERROR   | [x] Expected 2 space(s) before asterisk; 1 found
 15 | ERROR   | [x] Expected 2 space(s) before asterisk; 1 found
 23 | ERROR   | [x] Case breaking statement indented incorrectly; expected 6 spaces, found 4
 28 | WARNING | [ ] Doc comment indicates hook_form_alter() but function signature is "user_view_mode_form_user_role_form_alter" instead of "user_view_mode_form_alter". Did you mean hook_form_FORM_ID_alter()?
 32 | ERROR   | [x] Data types in @var tags need to be fully namespaced
 63 | ERROR   | [x] Data types in @var tags need to be fully namespaced
 70 | ERROR   | [x] Missing function doc comment
 70 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
 71 | ERROR   | [ ] Unnecessarily gendered language in a comment
 73 | ERROR   | [x] Data types in @var tags need to be fully namespaced
 78 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 78 | ERROR   | [x] Expected 1 space after closing parenthesis; found 0
 82 | WARNING | [ ] Line exceeds 80 characters; contains 116 characters
 83 | WARNING | [x] 'TODO: It should be lowest weight?' should match the format '@todo Fix problem X here.'
 89 | ERROR   | [x] Expected newline after closing brace
 89 | ERROR   | [x] Expected 1 space after ELSE keyword; 0 found
 91 | ERROR   | [x] Expected 1 space after FOR keyword; 0 found
 91 | ERROR   | [x] Expected 1 space after closing parenthesis; found 0
 93 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 93 | ERROR   | [x] Expected 1 space after closing parenthesis; found 0
 97 | ERROR   | [x] Expected 1 space before "?"; 0 found
 97 | ERROR   | [x] Expected 1 space after "?"; 0 found
 97 | ERROR   | [x] Expected 1 space before ":"; 0 found
 97 | ERROR   | [x] Expected 1 space after ":"; 0 found
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 25 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Time: 838ms; 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

  • Issue created by @sidharth_soman
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India sidharth_soman Bangalore

    Issues are fixed. Please review the patch.

  • Status changed to RTBC 12 months ago
  • 🇭🇺Hungary denes.szabo Hungary

    I can confirm, after apply sidharth_soman's patch the module seems was better according to the coding standard.

    I fixed just one small word in it:

    // Chenge view mode according to their role. -> // Change view mode according to their role.

    Attached.

Production build 0.71.5 2024