Fix the issues reported by phpcs

Created on 3 March 2023, over 1 year ago
Updated 9 March 2023, over 1 year ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/webform_score/webform_score.info.yml
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------
7 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
8 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
----------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/webform_score/webform_score.module
------------------------------------------------------------------------------------------------
FOUND 17 ERRORS AND 3 WARNINGS AFFECTING 17 LINES
------------------------------------------------------------------------------------------------
8 | ERROR | [x] When importing a class with "use", do not include a leading \
9 | ERROR | [x] When importing a class with "use", do not include a leading \
10 | ERROR | [x] When importing a class with "use", do not include a leading \
11 | ERROR | [x] When importing a class with "use", do not include a leading \
12 | ERROR | [x] When importing a class with "use", do not include a leading \
13 | ERROR | [x] When importing a class with "use", do not include a leading \
14 | ERROR | [x] When importing a class with "use", do not include a leading \
15 | ERROR | [x] When importing a class with "use", do not include a leading \
76 | WARNING | [ ] Code after the RETURN statement on line 74 cannot be executed
76 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 10
79 | ERROR | [x] Case breaking statements must be followed by a single blank line
80 | WARNING | [ ] Code after the RETURN statement on line 79 cannot be executed
80 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 10
84 | WARNING | [ ] Code after the RETURN statement on line 83 cannot be executed
84 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 10
122 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
131 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
136 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
141 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
160 | ERROR | [x] Expected 1 newline at end of file; 2 found
------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 17 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/webform_score/README.txt
----------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
----------------------------------------------------------------------
3 | WARNING | Line exceeds 80 characters; contains 92 characters
7 | WARNING | Line exceeds 80 characters; contains 91 characters
32 | WARNING | Line exceeds 80 characters; contains 148 characters
----------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/webform_score/src/Plugin/WebformScore/SetEquals.php
---------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
---------------------------------------------------------------------------------------
83 | WARNING | Unused variable $key.
127 | WARNING | #description values usually have to run through t() for translation
---------------------------------------------------------------------------------------

Time: 3.97 secs; Memory: 6MB

Steps to reproduce

Run following command

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/webform_score/

Proposed resolution

Above error/warnings need to be fixed.

๐Ÿ“Œ Task
Status

Fixed

Version

2.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia samit.310@gmail.com

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.69.0 2024