Fixing the coding standard issues | phpcs

Created on 3 April 2023, over 1 year ago
Updated 5 April 2023, over 1 year ago

Problem/Motivation

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\email_login_otp-3351829\css\email_login_otp.css
-----------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
-----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\email_login_otp-3351829\email_login_otp.install
-----------------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AND 10 WARNINGS AFFECTING 18 LINES
-----------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
3 | ERROR | [x] Missing function doc comment
12 | WARNING | [x] A comma should follow the last multiline array item. Found: 0
19 | WARNING | [x] A comma should follow the last multiline array item. Found: 0
26 | WARNING | [x] A comma should follow the last multiline array item. Found: 0
27 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
28 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
38 | WARNING | [x] A comma should follow the last multiline array item. Found: 0
45 | WARNING | [x] A comma should follow the last multiline array item. Found: ''
52 | WARNING | [x] A comma should follow the last multiline array item. Found: 0
53 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
54 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
59 | ERROR | [x] Missing function doc comment
62 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
62 | ERROR | [x] Object operator not indented correctly; expected 4 spaces but found 2
63 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
64 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
65 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
66 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
-----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 20 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\email_login_otp-3351829\email_login_otp.module
------------------------------------------------------------------------------------------------------------
FOUND 11 ERRORS AND 3 WARNINGS AFFECTING 13 LINES
------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
11 | WARNING | [x] Unused use statement
14 | ERROR | [x] There must be one blank line after the last USE statement; 2 found;
20 | ERROR | [x] Expected 1 blank line before function; 2 found
33 | ERROR | [x] Missing function doc comment
38 | WARNING | [x] A comma should follow the last multiline array item. Found: 'click'
43 | ERROR | [x] Missing function doc comment
54 | ERROR | [x] Concat operator must be surrounded by a single space
58 | ERROR | [ ] Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
90 | ERROR | [x] Concat operator must be surrounded by a single space
94 | ERROR | [x] Missing function doc comment
95 | WARNING | [ ] Unused variable $options.
95 | ERROR | [x] Short array syntax must be used to define arrays
107 | ERROR | [x] Case breaking statement indented incorrectly; expected 6 spaces, found 4
------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 12 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\email_login_otp-3351829\email_login_otp.routing.yml
------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------
7 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
32 | 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: C:\xampp\htdocs\backendassignment\web\modules\contrib\email_login_otp-3351829\README.md
---------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
---------------------------------------------------------------------------------------------
7 | WARNING | Line exceeds 80 characters; contains 90 characters
9 | WARNING | Line exceeds 80 characters; contains 87 characters
17 | WARNING | Line exceeds 80 characters; contains 106 characters
---------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\email_login_otp-3351829\src\Controller\GeneralController.php
------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 6 WARNINGS AFFECTING 7 LINES
------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
10 | WARNING | [x] Unused use statement
15 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
69 | WARNING | [ ] User::load calls should be avoided in classes, use dependency injection instead
72 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
72 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
78 | WARNING | [x] A comma should follow the last multiline array item. Found: )
82 | ERROR | [x] Missing function doc comment
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

FILE: ...htdocs\backendassignment\web\modules\contrib\email_login_otp-3351829\src\EventSubscriber\OtpRedirectSubscriber.php
------------------------------------------------------------------------------------------------------------------------
FOUND 9 ERRORS AND 3 WARNINGS AFFECTING 12 LINES
------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
20 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
42 | ERROR | [ ] Class property $email_login_otp should use lowerCamel naming without underscores
69 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
70 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 7 spaces but found 3 spaces
72 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space
73 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
74 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
95 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
96 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
110 | WARNING | [ ] User::load calls should be avoided in classes, use dependency injection instead
115 | WARNING | [x] A comma should follow the last multiline array item. Found: 'email_login_otp.otp_settings_form'
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\email_login_otp-3351829\src\Form\ConfigForm.php
---------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 8 WARNINGS AFFECTING 9 LINES
---------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
11 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
62 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
63 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
64 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
69 | WARNING | [ ] Avoid backslash escaping in translatable strings when possible, use "" quotes instead
88 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
89 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
90 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\email_login_otp-3351829\src\Form\OTPForm.php
----------------------------------------------------------------------------------------------------------------------
FOUND 8 ERRORS AND 6 WARNINGS AFFECTING 13 LINES
----------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
6 | WARNING | [x] Unused use statement
17 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
18 | ERROR | [ ] Class name doesn't match filename; expected "class OTPForm"
48 | ERROR | [x] Missing function doc comment
58 | ERROR | [x] Expected 1 blank line after function; 0 found
77 | WARNING | [x] A comma should follow the last multiline array item. Found: TRUE
84 | WARNING | [x] A comma should follow the last multiline array item. Found: 'click'
85 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
89 | ERROR | [x] Concat operator must be surrounded by a single space
89 | ERROR | [x] Concat operator must be surrounded by a single space
108 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
113 | ERROR | [x] Missing function doc comment
135 | WARNING | [ ] User::load calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 11 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\email_login_otp-3351829\src\Form\OtpSettingsForm.php
------------------------------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AND 14 WARNINGS AFFECTING 20 LINES
------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
14 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
103 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
104 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
105 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
114 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
115 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
116 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
123 | WARNING | [x] A comma should follow the last multiline array item. Found: 2
131 | WARNING | [x] A comma should follow the last multiline array item. Found: '::otpSendCallback'
132 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
141 | WARNING | [x] A comma should follow the last multiline array item. Found: "

"
147 | WARNING | [x] A comma should follow the last multiline array item. Found: )
161 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
167 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
180 | ERROR | [ ] The array declaration extends to column 107 (the limit is 80). The array content should be split
| | up over multiple lines
220 | WARNING | [x] A comma should follow the last multiline array item. Found: "

"
223 | ERROR | [x] Expected 1 space between "'display'" and double arrow; 0 found
223 | ERROR | [x] Expected 1 space between double arrow and "'none'"; 0 found
223 | ERROR | [x] Expected 1 space before "=>"; 0 found
223 | ERROR | [x] Expected 1 space after "=>"; 0 found
228 | WARNING | [ ] Unused private method getDefault()
228 | ERROR | [x] Missing function doc comment
231 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 14
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 21 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\email_login_otp-3351829\src\Services\Otp.php
--------------------------------------------------------------------------------------------------------
FOUND 43 ERRORS AND 4 WARNINGS AFFECTING 43 LINES
--------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
3 | ERROR | [x] There must be one blank line after the namespace declaration
10 | ERROR | [x] Missing class doc comment
11 | ERROR | [ ] Missing member variable doc comment
12 | ERROR | [ ] Missing member variable doc comment
13 | ERROR | [ ] Missing member variable doc comment
15 | ERROR | [ ] Missing member variable doc comment
16 | ERROR | [ ] Missing member variable doc comment
18 | ERROR | [x] Missing function doc comment
26 | ERROR | [x] Missing function doc comment
37 | ERROR | [x] Missing function doc comment
37 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
40 | ERROR | [x] Concat operator must be surrounded by a single space
47 | ERROR | [x] Missing function doc comment
50 | ERROR | [x] Object operator not indented correctly; expected 8 spaces but found 16
55 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
57 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
59 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
62 | ERROR | [x] Missing function doc comment
64 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 14
69 | ERROR | [x] Missing function doc comment
69 | ERROR | [ ] Public method name "Otp::is_enabled" is not in lowerCamel format
71 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 14
75 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
78 | ERROR | [x] Missing function doc comment
80 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 14
83 | ERROR | [x] Expected 1 space after IF keyword; 0 found
85 | ERROR | [x] Object operator not indented correctly; expected 8 spaces but found 16
94 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 22
100 | ERROR | [x] Missing function doc comment
102 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 14
113 | ERROR | [x] Missing function doc comment
115 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 14
122 | ERROR | [x] Missing function doc comment
125 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 14
132 | ERROR | [x] Missing function doc comment
134 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 14
138 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
141 | ERROR | [x] Missing function doc comment
143 | WARNING | [ ] Unused variable $insert_otp_info.
146 | ERROR | [x] Expected one space after the comma, 0 found
146 | WARNING | [x] A comma should follow the last multiline array item. Found: )
151 | ERROR | [x] Missing function doc comment
153 | WARNING | [ ] Unused variable $update_otp_info.
154 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 14
156 | ERROR | [x] Expected one space after the comma, 0 found
156 | WARNING | [x] A comma should follow the last multiline array item. Found: )
--------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 39 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------

Time: 2.12 secs; Memory: 6MB

Steps to reproduce

Run phpcs command on the module.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

1.1

Component

Code

Created by

🇮🇳India sidharth_soman Bangalore

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

Comments & Activities

  • Issue created by @sidharth_soman
  • Status changed to Needs work over 1 year ago
  • 🇮🇳India sidharth_soman Bangalore

    Hi, upon running phpcs command I am finding the issues as mentioned in the summary. I will work on solving these.

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

    I have fixed most of the issues except dependency injection and documentation gaps... which should be ideally fixed by the maintainers themselves. I have issued an MR. Please review.
    Thanks.

  • Status changed to Fixed over 1 year ago
  • 🇵🇰Pakistan Ahmed.Raza

    Sidharth thank you for reporting this and bringing this to my attention and for your time on resolving the issue. I have also resolved the dependency injection issues in the files and resolved a few other phpcs related issues such as doc blocks etc. You can update your module to 1.1.2 which contains these phpcs fixes. Thanks

  • Status changed to Fixed over 1 year ago
Production build 0.71.5 2024