Drupal Coding Standards Issues | phpcs

Created on 8 February 2023, almost 2 years ago
Updated 11 July 2024, 6 months ago

FILE: /var/www/html/contribution/web/modules/contrib/daterange_picker/daterange_picker.module
---------------------------------------------------------------------------------------------
FOUND 7 ERRORS AFFECTING 5 LINES
---------------------------------------------------------------------------------------------
3 | ERROR | [ ] Missing short description in doc comment
19 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
19 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 3
19 | ERROR | [x] Concat operator must be surrounded by a single space
24 | ERROR | [x] Expected 1 newline at end of file; 5 found
27 | ERROR | [ ] More than 2 empty lines are not allowed
28 | ERROR | [ ] More than 2 empty lines are not allowed
---------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/daterange_picker/css/daterangepicker.css
---------------------------------------------------------------------------------------------
FOUND 17 ERRORS AFFECTING 13 LINES
---------------------------------------------------------------------------------------------
20 | ERROR | [x] Multiple selectors should each be on a single line
91 | ERROR | [x] Multiple selectors should each be on a single line
128 | ERROR | [x] Multiple selectors should each be on a single line
147 | ERROR | [x] Multiple selectors should each be on a single line
175 | ERROR | [x] Multiple selectors should each be on a single line
181 | ERROR | [x] Multiple selectors should each be on a single line
186 | ERROR | [x] Multiple selectors should each be on a single line
186 | ERROR | [x] Multiple selectors should each be on a single line
186 | ERROR | [x] Multiple selectors should each be on a single line
211 | ERROR | [x] Multiple selectors should each be on a single line
221 | ERROR | [x] Multiple selectors should each be on a single line
227 | ERROR | [x] Multiple selectors should each be on a single line
244 | ERROR | [x] Multiple selectors should each be on a single line
244 | ERROR | [x] Multiple selectors should each be on a single line
244 | ERROR | [x] Multiple selectors should each be on a single line
355 | ERROR | [x] Multiple selectors should each be on a single line
389 | ERROR | [x] Multiple selectors should each be on a single line
---------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 17 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/daterange_picker/src/Plugin/Field/FieldType/DateRangePickerType.php
------------------------------------------------------------------------------------------------------------------------
FOUND 82 ERRORS AFFECTING 43 LINES
------------------------------------------------------------------------------------------------------------------------
3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
12 | ERROR | [x] There must be one blank line after the last USE statement; 4 found;
15 | ERROR | [ ] More than 2 empty lines are not allowed
16 | ERROR | [ ] More than 2 empty lines are not allowed
28 | ERROR | [x] Whitespace found at end of line
30 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
30 | ERROR | [x] Whitespace found at end of line
31 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
31 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
32 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
33 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
34 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
34 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
34 | ERROR | [x] Expected 1 blank line before function; 2 found
35 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
35 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
35 | ERROR | [x] Short array syntax must be used to define arrays
36 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
36 | ERROR | [x] Line indented incorrectly; expected at least 4 spaces, found 2
36 | ERROR | [x] Array indentation error, expected 5 spaces but found 2
36 | ERROR | [x] Short array syntax must be used to define arrays
37 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
37 | ERROR | [x] Short array syntax must be used to define arrays
38 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
38 | ERROR | [x] Line indented incorrectly; expected at least 4 spaces, found 3
38 | ERROR | [x] Array indentation error, expected 6 spaces but found 3
39 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
39 | ERROR | [x] Line indented incorrectly; expected at least 4 spaces, found 3
39 | ERROR | [x] Array indentation error, expected 6 spaces but found 3
40 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
40 | ERROR | [x] Line indented incorrectly; expected at least 4 spaces, found 3
40 | ERROR | [x] Array indentation error, expected 6 spaces but found 3
41 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
42 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
43 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
44 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
44 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
44 | ERROR | [x] Expected 1 blank line after function; 2 found
45 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
45 | ERROR | [x] Whitespace found at end of line
46 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
46 | ERROR | [x] Whitespace found at end of line
47 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
47 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
48 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
49 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
50 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
50 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
51 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
51 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
52 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
52 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
53 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
53 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
53 | ERROR | [x] Expected 1 blank line after function; 2 found
54 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
54 | ERROR | [x] Whitespace found at end of line
55 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
55 | ERROR | [x] Whitespace found at end of line
56 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
56 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
57 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
58 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
59 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
59 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
60 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
60 | ERROR | [x] Whitespace found at end of line
61 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
61 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
62 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
62 | ERROR | [x] Whitespace found at end of line
63 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
63 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
64 | ERROR | [x] Object operator not indented correctly; expected 4 spaces but found 10
67 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
67 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
69 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
69 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 3
69 | ERROR | [x] Closing brace indented incorrectly; expected 1 spaces, found 3
69 | ERROR | [x] Expected 1 blank line after function; 2 found
72 | ERROR | [x] Expected 1 newline at end of file; 0 found
72 | ERROR | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 80 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/daterange_picker/src/Plugin/Field/FieldFormatter/DateRangePickerFormatter.php
----------------------------------------------------------------------------------------------------------------------------------
FOUND 7 ERRORS AFFECTING 5 LINES
----------------------------------------------------------------------------------------------------------------------------------
27 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 3 empty lines
28 | ERROR | [x] Whitespace found at end of line
37 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
41 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
41 | ERROR | [x] Whitespace found at end of line
42 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
42 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 1
----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/daterange_picker/src/Plugin/Field/FieldWidget/DateRangePicker.php
----------------------------------------------------------------------------------------------------------------------
FOUND 17 ERRORS AND 1 WARNING AFFECTING 15 LINES
----------------------------------------------------------------------------------------------------------------------
17 | ERROR | [x] Whitespace found at end of line
25 | ERROR | [x] There must be no blank lines after the function comment
29 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
29 | ERROR | [x] Use null coalesce operator instead of ternary operator.
30 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
31 | ERROR | [x] Array indentation error, expected 5 spaces but found 6
32 | ERROR | [x] Array indentation error, expected 5 spaces but found 6
33 | ERROR | [x] Array indentation error, expected 5 spaces but found 6
36 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
36 | ERROR | [x] Line indented incorrectly; expected at least 6 spaces, found 3
36 | ERROR | [x] Array indentation error, expected 5 spaces but found 3
37 | ERROR | [x] Array indentation error, expected 5 spaces but found 8
38 | WARNING | [x] A comma should follow the last multiline array item. Found: 'daterange_picker/daterange_picker'
40 | ERROR | [x] Array closing indentation error, expected 3 spaces but found 6
41 | ERROR | [x] Array closing indentation error, expected 3 spaces but found 4
42 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
46 | ERROR | [x] Expected 1 blank line after function; 2 found
49 | ERROR | [x] The closing brace for the class must have an empty line before it
----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 18 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/daterange_picker/daterange_picker.libraries.yml
----------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------
10 | ERROR | [x] Expected 1 newline at end of file; 2 found
----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/daterange_picker/README.md
-------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------
27 | WARNING | Line exceeds 80 characters; contains 124 characters
-------------------------------------------------------------------------------

๐Ÿ“Œ Task
Status

RTBC

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia himanshu_jhaloya Indore

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

Merge Requests

Comments & Activities

  • Issue created by @himanshu_jhaloya
  • Merge request !4fixed phpcs issue โ†’ (Open) created by himanshu_jhaloya
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines kenyoOwen

    Hi himanshu_jhaloya

    I applied your MR to the โ€œCustom Date Range Picker โ€ module and there are some phpcs warning shown and I'll put this to needs work for the maintainer to decide if it needs to be fixed or not. Please see the screenshots attached.

    For your review.
    Thank you.

  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia ashutosh ahirwal India

    Hi,
    I have fixed all the error and Warning.
    please review.

  • Hi, patch #5 applied cleanly , but still found few errors.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dev16.addweb

    silvi.addweb โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dev16.addweb

    Hi, I have fix below remaining phpcs issue, Please review.

    modules/custom/datarange_picker/src/Plugin/Field/FieldFormatter/DateRangePickerFormatter.php
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldItemListInterface.
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 97ms; Memory: 12MB
    
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia akashpj

    I have tried to apply the MR 4 in Drpal 10.2.x but MR failed to apply and i got the below error

    $ git apply -v 4.diff
    4.diff:11: trailing whitespace.
      daterangepicker.min.js, daterangepicker.css" Library.
    Checking patch README.md...
    Checking patch css/daterangepicker.css...
    Checking patch daterange_picker.info.yml...
    error: while searching for:
    description: 'Provides the ability to select from and to-date.'
    package: daterange_picker
    core_version_requirement: ^9 || ^10
    
    
    error: patch failed: daterange_picker.info.yml:3
    error: daterange_picker.info.yml: patch does not apply
    Checking patch daterange_picker.libraries.yml...
    Checking patch daterange_picker.module...
    Checking patch src/Plugin/Field/FieldFormatter/DateRangePickerFormatter.php...
    Checking patch src/Plugin/Field/FieldType/DateRangePickerType.php...
    Checking patch src/Plugin/Field/FieldWidget/DateRangePicker.php...
    
    
  • Status changed to RTBC 6 months ago
  • Hi @silvi.addweb,

    Applied your changes in the MR!4, it applied successfully and confirmed phpcs issues are fixed.

    daterange_picker git:(main) curl https://git.drupalcode.org/project/daterange_picker/-/merge_requests/4.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 11198    0 11198    0     0  16957      0 --:--:-- --:--:-- --:--:-- 17122
    patching file README.md
    patching file css/daterangepicker.css
    patching file daterange_picker.info.yml
    patching file daterange_picker.libraries.yml
    patching file daterange_picker.module
    patching file src/Plugin/Field/FieldFormatter/DateRangePickerFormatter.php
    patching file src/Plugin/Field/FieldType/DateRangePickerType.php
    patching file src/Plugin/Field/FieldWidget/DateRangePicker.php
    โžœ  daterange_picker git:(main) โœ— cd ..
    โžœ  contrib git:(main) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig daterange_picker
    โžœ  contrib git:(main) โœ—

    Will now move this to RTBC

    Thanks,
    Jake

Production build 0.71.5 2024