Fix the issues reported by phpcs

Created on 4 July 2023, over 1 year ago
Updated 2 January 2024, 12 months ago

Problem/Motivation

FILE: /var/www/html/vb/d_cont/ludt/README.txt
-----------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------
33 | WARNING | [ ] Line exceeds 80 characters; contains 87 characters
33 | ERROR | [x] Expected 1 newline at end of file; 2 found
-----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/ludt/ludt.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
7 | WARNING | All dependencies must be prefixed with the project name, for
| | example "drupal:"
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/ludt/ludt.routing.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
24 | WARNING | The administration page callback should probably use
| | "administer site configuration" - which implies the user can
| | change something - rather than "access administration pages"
| | which is about viewing but not changing configurations.
31 | WARNING | The administration page callback should probably use
| | "administer site configuration" - which implies the user can
| | change something - rather than "access administration pages"
| | which is about viewing but not changing configurations.
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/ludt/src/Form/LudtSettings.php
--------------------------------------------------------------------------------
FOUND 22 ERRORS AND 4 WARNINGS AFFECTING 16 LINES
--------------------------------------------------------------------------------
10 | WARNING | [ ] The class short comment should describe what the class
| | does and not simply repeat the class name
35 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
35 | ERROR | [x] 4 spaces found before inline comment; expected "//
| | Indoor/Zonal Config Settings" but found "//
| | Indoor/Zonal Config Settings"
35 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
66 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
66 | ERROR | [x] 4 spaces found before inline comment; expected "//
| | $form['ludt_zonal_settings']['ludt_zonal_settings_base_url']
| | = [" but found "//
| | $form['ludt_zonal_settings']['ludt_zonal_settings_base_url']
| | = ["
67 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
67 | ERROR | [ ] Comment indentation error, expected only 4 spaces
68 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
69 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
70 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
71 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
72 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
73 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
74 | ERROR | [x] Short array syntax must be used to define arrays
82 | WARNING | [x] There must be no blank line following an inline comment
82 | WARNING | [ ] There must be no blank line following an inline comment
82 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
82 | ERROR | [x] 4 spaces found before inline comment; expected "//
| | Output/Area Config Settings" but found "// Output/Area
| | Config Settings"
82 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
114 | ERROR | [x] Short array syntax must be used to define arrays
135 | WARNING | [ ] Line exceeds 80 characters; contains 92 characters
135 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
135 | ERROR | [x] 6 spaces found before inline comment; expected "//
| | ->set('ludt_zonal_settings_base_url',
| | $zonal_values['ludt_zonal_settings_base_url'])" but found
| | "// ->set('ludt_zonal_settings_base_url',
| | $zonal_values['ludt_zonal_settings_base_url'])"
143 | ERROR | [x] Expected 1 blank line after function; 0 found
144 | ERROR | [x] The closing brace for the class must have an empty line
| | before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 22 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/ludt/src/Controller/ZonalLudtController.php
--------------------------------------------------------------------------------
FOUND 27 ERRORS AND 1 WARNING AFFECTING 18 LINES
--------------------------------------------------------------------------------
14 | WARNING | [ ] The class short comment should describe what the class does
| | and not simply repeat the class name
16 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
16 | ERROR | [ ] Missing short description in doc comment
17 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found
18 | ERROR | [x] Expected 1 space(s) before asterisk; 3 found
21 | ERROR | [ ] Missing short description in doc comment
30 | ERROR | [ ] Missing parameter comment
30 | ERROR | [x] Data types in @param tags need to be fully namespaced
31 | ERROR | [ ] Missing parameter comment
31 | ERROR | [x] Data types in @param tags need to be fully namespaced
33 | ERROR | [x] Expected 1 blank line before function; 2 found
60 | ERROR | [ ] The array declaration extends to column 102 (the limit is
| | 80). The array content should be split up over multiple
| | lines
60 | ERROR | [x] There should be no white space after an opening "["
60 | ERROR | [x] Expected 1 space between "'status'" and double arrow; 0
| | found
60 | ERROR | [x] Expected 1 space before "=>"; 0 found
67 | ERROR | [ ] Doc comment short description must be on a single line,
| | further text should be a separate paragraph
69 | ERROR | [ ] Description for the @return value is missing
73 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
74 | ERROR | [x] Concat operator must be surrounded by a single space
74 | ERROR | [x] Concat operator must be surrounded by a single space
77 | ERROR | [x] Concat operator must be surrounded by a single space
77 | ERROR | [x] Concat operator must be surrounded by a single space
78 | ERROR | [x] Concat operator must be surrounded by a single space
78 | ERROR | [x] Concat operator must be surrounded by a single space
80 | ERROR | [x] Concat operator must be surrounded by a single space
80 | ERROR | [x] Concat operator must be surrounded by a single space
84 | ERROR | [x] Doc comment short description must end with a full stop
88 | ERROR | [x] Concat operator must be surrounded by a single space
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 20 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/ludt/src/Controller/LudtAuthController.php
--------------------------------------------------------------------------------
FOUND 22 ERRORS AND 4 WARNINGS AFFECTING 18 LINES
--------------------------------------------------------------------------------
12 | WARNING | [ ] The class short comment should describe what the class does
| | and not simply repeat the class name
38 | ERROR | [x] Expected 1 space after IF keyword; 0 found
47 | ERROR | [x] Missing function doc comment
53 | ERROR | [x] Short array syntax must be used to define arrays
55 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but
| | found "true"
56 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but
| | found "true"
57 | ERROR | [x] Concat operator must be surrounded by a single space
57 | ERROR | [x] Concat operator must be surrounded by a single space
57 | ERROR | [x] Concat operator must be surrounded by a single space
57 | ERROR | [x] Concat operator must be surrounded by a single space
57 | WARNING | [x] A comma should follow the last multiline array item. Found:
| | '"}'
67 | ERROR | [x] Expected 1 blank line after function; 3 found
70 | ERROR | [ ] More than 2 empty lines are not allowed
73 | ERROR | [x] There must be no blank lines after the function comment
76 | ERROR | [x] Expected 1 space after IF keyword; 0 found
85 | ERROR | [x] Doc comment short description must end with a full stop
86 | ERROR | [x] There must be no blank lines after the function comment
90 | WARNING | [ ] Unused variable $areaUrl.
94 | ERROR | [x] Short array syntax must be used to define arrays
96 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but
| | found "true"
97 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but
| | found "true"
98 | ERROR | [x] Concat operator must be surrounded by a single space
98 | ERROR | [x] Concat operator must be surrounded by a single space
98 | ERROR | [x] Concat operator must be surrounded by a single space
98 | ERROR | [x] Concat operator must be surrounded by a single space
98 | WARNING | [x] A comma should follow the last multiline array item. Found:
| | '"}'
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 23 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/ludt/src/Controller/AreaLudtController.php
--------------------------------------------------------------------------------
FOUND 20 ERRORS AND 2 WARNINGS AFFECTING 18 LINES
--------------------------------------------------------------------------------
14 | WARNING | [ ] The class short comment should describe what the class does
| | and not simply repeat the class name
16 | ERROR | [x] Opening brace should be on the same line as the declaration
17 | ERROR | [ ] Missing short description in doc comment
18 | ERROR | [x] Data types in @var tags need to be fully namespaced
22 | ERROR | [ ] Missing short description in doc comment
23 | ERROR | [x] Data types in @var tags need to be fully namespaced
30 | ERROR | [ ] Missing parameter comment
30 | ERROR | [x] Data types in @param tags need to be fully namespaced
31 | ERROR | [ ] Missing parameter comment
31 | ERROR | [x] Data types in @param tags need to be fully namespaced
34 | ERROR | [x] Opening brace should be on the same line as the declaration
43 | ERROR | [x] Opening brace should be on the same line as the declaration
57 | ERROR | [x] Opening brace should be on the same line as the declaration
59 | WARNING | [ ] Line exceeds 80 characters; contains 90 characters
59 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
59 | ERROR | [x] 4 spaces found before inline comment; expected "//
| | $displayType =
| | $this->requestStack->getCurrentRequest()->query->get('display_type');"
| | but found "// $displayType =
| | $this->requestStack->getCurrentRequest()->query->get('display_type');"
62 | ERROR | [x] Expected newline after closing brace
63 | ERROR | [ ] The array declaration extends to column 102 (the limit is
| | 80). The array content should be split up over multiple
| | lines
68 | ERROR | [x] Doc comment short description must start with a capital
| | letter
74 | ERROR | [x] Opening brace should be on the same line as the declaration
88 | ERROR | [x] Missing function doc comment
89 | ERROR | [x] Opening brace should be on the same line as the declaration
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 15 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/ludt/src/Plugin/Block/LudtBlock.php
--------------------------------------------------------------------------------
FOUND 64 ERRORS AND 7 WARNINGS AFFECTING 47 LINES
--------------------------------------------------------------------------------
9 | WARNING | [x] Unused use statement
22 | ERROR | [x] No space found before comment text; expected "//
| | constants" but found "//constants"
22 | ERROR | [x] Inline comments must start with a capital letter
22 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
24 | ERROR | [x] Expected 1 space after "="; 0 found
37 | ERROR | [ ] Missing short description in doc comment
69 | ERROR | [x] Expected 1 space after IF keyword; 0 found
74 | ERROR | [x] Expected 1 space after IF keyword; 0 found
76 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
79 | ERROR | [x] Expected 1 space after IF keyword; 0 found
81 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 12
81 | ERROR | [x] Expected 1 space after IF keyword; 0 found
82 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 14
85 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
86 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
87 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
88 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
88 | ERROR | [x] Expected 1 space after IF keyword; 0 found
88 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE"
| | but found "false"
88 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE"
| | but found "false"
89 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 16
89 | ERROR | [x] Concat operator must be surrounded by a single space
89 | ERROR | [x] Concat operator must be surrounded by a single space
90 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
91 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
92 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
92 | ERROR | [x] Expected 1 space after IF keyword; 0 found
92 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE"
| | but found "false"
92 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE"
| | but found "false"
93 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 16
93 | ERROR | [x] Concat operator must be surrounded by a single space
93 | ERROR | [x] Concat operator must be surrounded by a single space
94 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
95 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
96 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
97 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 12
98 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 12
99 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 14
99 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
100 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 14
103 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
104 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
105 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
106 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
106 | ERROR | [x] Expected 1 space after IF keyword; 0 found
106 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE"
| | but found "false"
106 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE"
| | but found "false"
107 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 16
107 | ERROR | [x] Concat operator must be surrounded by a single space
107 | ERROR | [x] Concat operator must be surrounded by a single space
108 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
109 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
110 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
110 | ERROR | [x] Expected 1 space after IF keyword; 0 found
110 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE"
| | but found "false"
110 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE"
| | but found "false"
111 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 16
111 | ERROR | [x] Concat operator must be surrounded by a single space
111 | ERROR | [x] Concat operator must be surrounded by a single space
112 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
113 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
114 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 14
115 | ERROR | [x] Closing brace indented incorrectly; expected 12 spaces,
| | found 10
118 | ERROR | [x] Expected 1 space before "="; 0 found
147 | ERROR | [x] No space found before comment text; expected "// $form =
| | parent::blockForm($form, $form_state);" but found "//$form
| | = parent::blockForm($form, $form_state);"
150 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
151 | WARNING | [ ] Only string literals should be passed to t() where
| | possible
155 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
156 | WARNING | [ ] Only string literals should be passed to t() where
| | possible
160 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
161 | WARNING | [ ] Only string literals should be passed to t() where
| | possible
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 64 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/ludt/ludt.module
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
33 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but
| | found "null"
37 | ERROR | [x] Expected 1 newline at end of file; 2 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 228ms; 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 ludt/

Remaining tasks

Patch review

📌 Task
Status

RTBC

Version

1.0

Component

Code

Created by

🇮🇳India urvashi_vora Madhya Pradesh, India

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 @urvashi_vora
  • Hello, @urvashi_vora thanks for the patch, I have applied your patch and ran successfully.

    These are the steps I followed:

    1. Took clone from git version 1.0.x in drupal 10.1.x

    2. Ran this command:

    ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig modules/contrib/ludt/

    3. Applied your patch and, again ran phpcs command

    found errors.

    4. I have created a patch and fixed all the errors.

    again check with phpcs command

    ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig modules/contrib/ludt/

    found no errors.

    Please review.

  • Status changed to RTBC 12 months ago
  • 🇮🇳India ashutosh ahirwal India

    Patch provided in #2 get applied cleanly and no errors/warning found.
    Moving to RTBC.

Production build 0.71.5 2024