Drupal Coding Standards Issues | phpcs

Created on 2 February 2023, over 1 year ago
Updated 15 July 2024, 2 months ago

Problem/Motivation

Getting following error/warnings.

FILE: ...xampp\htdocs\abc\drupal\modules\menu_animate\menu_animate.module
----------------------------------------------------------------------
FOUND 17 ERRORS AND 2 WARNINGS AFFECTING 17 LINES
----------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n"
| | but found "\r\n"
12 | ERROR | [x] Function comment short description must start
| | with exactly one space
27 | ERROR | [x] Expected 1 space(s) before asterisk; 2 found
28 | ERROR | [x] Expected 1 space(s) before asterisk; 2 found
42 | WARNING | [ ] Translatable strings must not begin or end with
| | white spaces, use placeholders with t() for
| | variables
44 | ERROR | [x] Use null coalesce operator instead of ternary
| | operator.
51 | WARNING | [ ] Avoid backslash escaping in translatable strings
| | when possible, use "" quotes instead
52 | ERROR | [x] Use null coalesce operator instead of ternary
| | operator.
58 | ERROR | [x] Expected 1 space(s) before asterisk; 2 found
59 | ERROR | [x] Expected 1 space(s) before asterisk; 2 found
65 | ERROR | [ ] The array declaration extends to column 93 (the
| | limit is 80). The array content should be split
| | up over multiple lines
71 | ERROR | [x] Expected 1 space(s) before asterisk; 2 found
72 | ERROR | [x] Expected 1 space(s) before asterisk; 2 found
75 | ERROR | [x] Inline comments must start with a capital letter
75 | ERROR | [x] Inline comments must end in full-stops,
| | exclamation marks, question marks, colons, or
| | closing parentheses
79 | ERROR | [x] Expected 1 space before ":"; 0 found
81 | ERROR | [x] Concat operator must be surrounded by a single
| | space
81 | ERROR | [x] Concat operator must be surrounded by a single
| | space
85 | ERROR | [x] Expected 1 blank line after function; 2 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 16 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Time: 514ms; Memory: 10MB

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/menu_animate/

Proposed resolution

Above error/warnings need to be fixed.

📌 Task
Status

Fixed

Version

1.1

Component

Code

Created by

🇮🇳India Charchil Khandelwal

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024