Problem/Motivation
I ran this following phpcs command and errors were reported below.
phpcs \
--standard=Drupal,DrupalPractice -n \
--extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig \
--ignore="*.features.*,*.pages*.inc,*/node_modules/*" \
custom_view_filters/
FILE: /custom_view_filters/src/Plugin/views/filter/DateRangePickerFilter.php
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AFFECTING 10 LINES
-------------------------------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
| | Drupal\views\Plugin\views\display\DisplayPluginBase.
52 | ERROR | [x] Use null coalesce operator instead of ternary operator.
58 | ERROR | [x] Use null coalesce operator instead of ternary operator.
90 | ERROR | [x] Expected 1 blank line after function; 2 found
111 | ERROR | [x] Expected 1 blank line after function; 2 found
117 | ERROR | [ ] Missing parameter type
119 | ERROR | [ ] Missing parameter type
215 | ERROR | [x] Use null coalesce operator instead of ternary operator.
221 | ERROR | [x] Use null coalesce operator instead of ternary operator.
247 | ERROR | [x] Use null coalesce operator instead of ternary operator.
-------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------
FILE: /custom_view_filters/src/Plugin/views/filter/CustomAzFilter.php
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
| | Drupal\views\Plugin\views\display\DisplayPluginBase.
211 | ERROR | [x] Use null coalesce operator instead of ternary operator.
238 | ERROR | [x] Use null coalesce operator instead of ternary operator.
-------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------
FILE: /custom_view_filters/src/Plugin/views/filter/NodeGranularDateFilter.php
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AFFECTING 10 LINES
-------------------------------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
| | Drupal\views\Plugin\views\display\DisplayPluginBase.
167 | ERROR | [x] Parameter comment must end with a full stop
179 | ERROR | [ ] Missing parameter type
181 | ERROR | [ ] Missing parameter type
200 | ERROR | [x] Expected 1 space after "="; 2 found
290 | ERROR | [x] Use null coalesce operator instead of ternary operator.
297 | ERROR | [x] Use null coalesce operator instead of ternary operator.
325 | ERROR | [x] Use null coalesce operator instead of ternary operator.
329 | ERROR | [x] Short array syntax must be used to define arrays
337 | ERROR | [x] Short array syntax must be used to define arrays
-------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------
Time: 166ms; Memory: 12MB
I've uploaded a patch to fix these phpcs errors reported.
Comments
Comment #2
aayushmankotia commentedHi,
The patch
0001-Fix-the-errors-found-by-phpcs.patchhas been successfully applied, but it does not completely resolve all the errors. Please check the attached screenshot.Moving to Needs work.
Thanks.
Comment #5
chetan 11 commentedComment #6
chetan 11 commentedHi @Gab.
I fixed the phpcs issues, please review & let me know if any updates required.
Comment #7
aayushmankotia commentedHi chetan 11,
Merge request !6 has been successfully applied, but there are still remaining phpcs errors. A screenshot is attached for your reference. Please check.
Moving to Needs work.
Thanks.
Comment #8
imustakim commentedComment #9
imustakim commentedMR Updated.
Please review.
Comment #10
clarkssquared commentedHi imustakim,
I applied the updated MR !6 and I confirmed that it fixes all the PHPCS issues, the remaining issues being flagged are the project, version, and datestamp which I believe occurs when the module is installed via composer and I don't think this is a PHPCS issue, I will retain the status to needs review for others to review and give feedbacks to your patch. RTBC +1 from me.
Comment #11
gautam_105@ commented@imustakim,
I have applied the updated MR !6 and I confirmed that it fixes all the PHPCS issues.Moving to +RTBC. see the screenshot as well.
Comment #13
rcodinaComment #14
rcodinaThanks!
Comment #16
rcodina