Running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig shows the following errors/warnings, which should be fixed.
FILE: /./opquast_checklist/opquast_checklist.module
---------------------------------------------------
FOUND 18 ERRORS AND 6 WARNINGS AFFECTING 20 LINES
---------------------------------------------------
8 | WARNING | [x] Unused use statement
18 | ERROR | [x] Opening brace should be on the same line as the declaration
24 | ERROR | [x] Expected newline after closing brace
46 | ERROR | [x] Opening brace should be on the same line as the declaration
61 | WARNING | [ ] Avoid backslash escaping in translatable strings when possible, use "" quotes instead
71 | ERROR | [x] Opening brace should be on the same line as the declaration
76 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
80 | WARNING | [ ] Only string literals should be passed to t() where possible
89 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
103 | WARNING | [x] A comma should follow the last multiline array item. Found: )
109 | ERROR | [x] Expected 1 blank line after function; 2 found
113 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "*
| | Implements hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar() for
| | xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
114 | ERROR | [x] There must be exactly one blank line before the tags in a doc comment
114 | ERROR | [ ] Missing parameter comment
114 | ERROR | [ ] Missing parameter type
115 | ERROR | [ ] Missing parameter comment
115 | ERROR | [x] Data types in @param tags need to be fully namespaced
116 | ERROR | [ ] Missing parameter comment
116 | ERROR | [ ] Missing parameter type
119 | ERROR | [x] Opening brace should be on the same line as the declaration
120 | ERROR | [x] Data types in @var tags need to be fully namespaced
138 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
139 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
140 | ERROR | [x] Array closing indentation error, expected 4 spaces but found 6
---------------------------------------------------
PHPCBF CAN FIX THE 16 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------
FILE: /./opquast_checklist/src/Service/OpquastService.php
---------------------------------------------------------
FOUND 13 ERRORS AND 3 WARNINGS AFFECTING 14 LINES
---------------------------------------------------------
6 | ERROR | [x] Doc comment short description must end with a full stop
7 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
9 | ERROR | [x] Opening brace should be on the same line as the declaration
12 | WARNING | [ ] Line exceeds 80 characters; contains 106 characters
14 | ERROR | [ ] Missing parameter comment
15 | ERROR | [x] Separate the @param and @return sections by a blank line.
15 | ERROR | [ ] Description for the @return value is missing
18 | ERROR | [x] Opening brace should be on the same line as the declaration
23 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
35 | ERROR | [ ] Description for the @return value is missing
38 | ERROR | [x] Opening brace should be on the same line as the declaration
40 | ERROR | [x] Expected 1 blank line after function; 2 found
45 | ERROR | [x] There must be exactly one blank line before the tags in a doc comment
45 | ERROR | [ ] Description for the @return value is missing
48 | ERROR | [x] Opening brace should be on the same line as the declaration
50 | ERROR | [x] Expected 1 blank line after function; 0 found
---------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------
FILE: /./opquast_checklist/README.md
------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
------------------------------------
35 | WARNING | Line exceeds 80 characters; contains 117 characters
41 | WARNING | Line exceeds 80 characters; contains 91 characters
42 | WARNING | Line exceeds 80 characters; contains 93 characters
------------------------------------
Time: 109ms; Memory: 10MB
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | phpcs-issue-fixes-3360936-20.patch | 6.08 KB | bindu r |
| #18 | interdiff-9-18.txt | 1.11 KB | nitin_lama |
| #18 | phpcs-issue-fixes-3360936-18.patch | 9.33 KB | nitin_lama |
| #12 | #9 patch error.png | 44.3 KB | thakurnishant_06 |
| #12 | #2 patch error.png | 216.18 KB | thakurnishant_06 |
Comments
Comment #2
arpitk commentedHi, Here is the patch. Please review.
Thanks!
Comment #3
Jaspreet-Kaur commentedReviewed! After applying patch #2 all errors seems to be fixed.
Comment #4
raveen_thakur51 commentedHello arpitk,
I have reviewed your patch & Implemented it on my website having version 9.5.9 And PHP version - 8.1
I am adding some screenshots(before/after applying the patch) for your reference).
Please have a look once at these screenshots. And Thank You.
Comment #5
avpadernoThe report shows errors/warning for three files, but the patch changes four files.
Comment #6
ashutosh ahirwal commentedProviding patch with fixes.
Comment #7
avpadernoThe lines after the first one are indented two spaces more than needed.
Since the string delimiter has been changed, there is no need to escape the single quotes inside the string.
A class description must not repeat the class name. to provides services is a too broad description.
The description for a constructor must start with
Constructs a newfollowed by the class name (including its namespace), and end withobject.The documentation comment must also describe the constructor parameters.
A method description must not start with Function or Method.
The used verbs must be declined to the third person singular.
The longer description is not necessary and it is not grammatically correct.
url is misspelled, since it is an acronym.
It is not necessary to say variable and Path or URL. is too broad; at least it should say which path is passed to the method.
The return value type is already reported in the
@returnline; the description must describe what is returned.Since that documentation comment is changed, also the description must be changed.
The return value description is wrong for the same reason given before.
Comment #8
nitin_lamaComment #9
nitin_lamaAddressed #7.
Updated patch.
Comment #10
nitin_lamaComment #11
nitin_lamaProviding interdiff file for #9
Comment #12
thakurnishant_06 commentedHello Folks !!
Tested the #2 patch for opquast_checklist 2.0.3 on Drupal 9.5.9 and PHP 8.2, Got some phcs errors .
Later applied the # 9 patch using composer version 2.5. Couldn't apply patch!
I will be adding both screenshot for references.
Thank you.
Comment #13
avpadernoThe patch must be used with the 2.0.x branch, not a tagged release. With that branch, the patch applies.
Comment #14
avpadernoAnyway, running
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twigI get more errors. It seems the report shown in the issue summary is not complete.Comment #15
avpadernoComment #16
avpadernoThe class name is missing its namespace.
The verbs used in the description must be inflected in the third person singular.
base path of rules should be rules base path.
If not exist return english language. is not grammatically correct, and it must be changed to If it does not exist, returns the English language. It still not clear to what it does not exist is referring, though.
The return value is not the base URL, but the base path.
url is misspelled, since it is an acronym.
Comment #17
nitin_lamaComment #18
nitin_lamaAddressed #16. Updated patch.
Comment #19
nitin_lamaComment #20
bindu r commentedphpcs fixes.
Comment #23
martygraphie commentedHello everyone,
Thanks for the feedback and the associated patch.
I've gone back to patch 20 and fixed the latest PHPCS problems.
@aparderno I've also taken your feedback into account.
I've credited you all and I'm sorry for the lack of feedback over the last few months!
Marc
Comment #24
martygraphie commentedComment #25
martygraphie commentedComment #26
martygraphie commented