Fix the errors/warnings reported by PHP_CodeSniffer

Created on 3 January 2024, 6 months ago
Updated 27 February 2024, 4 months ago

Steps to reproduce

1: Installed and enabled the module using Composer with the command: composer require 'drupal/fullcalendar_view:^5.1'
2: Run below command on the composer-
phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml .\web\modules\contrib\fullcalendar_view

Errors:

FILE: ...mpp\htdocs\drupalDemo\modules\fullcalendar_view\fullcalendar_view.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by
| | drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be added by
| | drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by
| | drupal.org packaging automatically
--------------------------------------------------------------------------------

FILE: ...xampp\htdocs\drupalDemo\modules\fullcalendar_view\fullcalendar_view.module
--------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
--------------------------------------------------------------------------------
9 | ERROR | [x] Use statements should be sorted alphabetically. The first
| | wrong one is Drupal\Core\Datetime\DrupalDateTime.
54 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
59 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
132 | ERROR | [x] Whitespace found at end of line
183 | ERROR | [x] Whitespace found at end of line
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...pp\htdocs\drupalDemo\modules\fullcalendar_view\fullcalendar_view.theme.inc
--------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------
23 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
33 | ERROR | [x] Whitespace found at end of line
42 | ERROR | [x] Whitespace found at end of line
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\drupalDemo\modules\fullcalendar_view\README.md
-------------------------------------------------------------------------
FOUND 1 ERROR AND 14 WARNINGS AFFECTING 15 LINES
-------------------------------------------------------------------------
16 | WARNING | [ ] Line exceeds 80 characters; contains 108 characters
28 | WARNING | [ ] Line exceeds 80 characters; contains 203 characters
29 | WARNING | [ ] Line exceeds 80 characters; contains 122 characters
85 | WARNING | [ ] Line exceeds 80 characters; contains 159 characters
91 | WARNING | [ ] Line exceeds 80 characters; contains 108 characters
93 | WARNING | [ ] Line exceeds 80 characters; contains 148 characters
95 | WARNING | [ ] Line exceeds 80 characters; contains 192 characters
96 | WARNING | [ ] Line exceeds 80 characters; contains 88 characters
98 | WARNING | [ ] Line exceeds 80 characters; contains 191 characters
100 | WARNING | [ ] Line exceeds 80 characters; contains 225 characters
124 | WARNING | [ ] Line exceeds 80 characters; contains 155 characters
139 | WARNING | [ ] Line exceeds 80 characters; contains 106 characters
152 | WARNING | [ ] Line exceeds 80 characters; contains 133 characters
156 | WARNING | [ ] Line exceeds 80 characters; contains 113 characters
196 | ERROR | [x] Expected 1 newline at end of file; 3 found
-------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------

FILE: ...emo\modules\fullcalendar_view\src\Annotation\FullcalendarViewProcessor.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 1 LINE
--------------------------------------------------------------------------------
35 | ERROR | [x] Doc comment short description must start with a capital
| | letter
35 | ERROR | [x] Doc comment short description must end with a full stop
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...lDemo\modules\fullcalendar_view\src\Controller\CalendarEventController.php
--------------------------------------------------------------------------------
FOUND 11 ERRORS AFFECTING 10 LINES
--------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first
| | wrong one is Drupal\Core\Access\CsrfTokenGenerator.
145 | ERROR | [x] Expected 1 space after closing parenthesis; found 21
150 | ERROR | [ ] There must be no space between ? and :
152 | ERROR | [x] Whitespace found at end of line
171 | ERROR | [x] Expected 1 space after closing parenthesis; found 21
176 | ERROR | [ ] There must be no space between ? and :
189 | ERROR | [x] Expected 1 space after closing parenthesis; found 21
194 | ERROR | [ ] There must be no space between ? and :
253 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
253 | ERROR | [x] Object operator not indented correctly; expected 10 spaces
| | but found 8
254 | ERROR | [x] Object operator not indented correctly; expected 8 spaces
| | but found 10
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...cs\drupalDemo\modules\fullcalendar_view\src\FullcalendarViewPreprocess.php
--------------------------------------------------------------------------------
FOUND 39 ERRORS AND 9 WARNINGS AFFECTING 37 LINES
--------------------------------------------------------------------------------
8 | WARNING | [x] Unused use statement
9 | ERROR | [x] Use statements should be sorted alphabetically. The first
| | wrong one is
| | Drupal\Core\Language\LanguageManagerInterface.
12 | WARNING | [x] Unused use statement
14 | ERROR | [x] Missing class doc comment
17 | ERROR | [x] Scope keyword "protected" must be followed by a single
| | space; found 2
17 | ERROR | [ ] Missing member variable doc comment
73 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
123 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
136 | ERROR | [x] Use null coalesce operator instead of ternary operator.
138 | ERROR | [x] Use null coalesce operator instead of ternary operator.
183 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE"
| | but found "false"
248 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
| | but found "true"
259 | ERROR | [x] Expected 1 space after "=>"; 2 found
284 | ERROR | [x] Inline comments must start with a capital letter
284 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
285 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
303 | WARNING | [ ] Line exceeds 80 characters; contains 83 characters
306 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
314 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
| | but found "true"
354 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
| | but found "true"
393 | ERROR | [x] There should be no white space after an opening "["
393 | ERROR | [x] Expected one space after the comma, 0 found
393 | ERROR | [x] There should be no white space before a closing "]"
395 | ERROR | [x] Use null coalesce operator instead of ternary operator.
396 | ERROR | [x] Use null coalesce operator instead of ternary operator.
397 | ERROR | [x] Use null coalesce operator instead of ternary operator.
402 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: 'dayGridMonth,timeGridWeek,timeGridDay,listYear'
426 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
| | but found "true"
426 | ERROR | [x] No space found before comment text; expected "// Enable to
| | be moved by mouse" but found "//Enable to be moved by
| | mouse"
426 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
426 | ERROR | [x] Comments may not appear after statements
427 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
| | but found "true"
427 | ERROR | [x] No space found before comment text; expected "// Enable to
| | be resized by mouse" but found "//Enable to be resized by
| | mouse"
427 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
427 | ERROR | [x] Comments may not appear after statements
428 | ERROR | [x] Expected 1 space after "=>"; 2 found
430 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: '1rem'
431 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: ]
454 | WARNING | [ ] Line exceeds 80 characters; contains 94 characters
472 | ERROR | [x] Use null coalesce operator instead of ternary operator.
496 | ERROR | [ ] Private method name
| | "FullcalendarViewPreprocess::fullcalendar_view_map_langcodes"
| | is not in lowerCamel format
499 | ERROR | [x] Case breaking statements must be followed by a single
| | blank line
501 | ERROR | [x] Case breaking statements must be followed by a single
| | blank line
503 | ERROR | [x] Case breaking statements must be followed by a single
| | blank line
505 | ERROR | [x] Case breaking statements must be followed by a single
| | blank line
509 | ERROR | [x] Expected 1 blank line after function; 0 found
510 | ERROR | [x] Expected 1 newline at end of file; 2 found
510 | ERROR | [x] The closing brace for the class must have an empty line
| | before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 43 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...emo\modules\fullcalendar_view\src\Plugin\FullcalendarViewProcessorBase.php
--------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
--------------------------------------------------------------------------------
12 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
13 | ERROR | [x] Whitespace found at end of line
20 | ERROR | [x] Expected 1 blank line after function; 0 found
21 | ERROR | [x] The closing brace for the class must have an empty line
| | before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...\modules\fullcalendar_view\src\Plugin\FullcalendarViewProcessorManager.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first
| | wrong one is Drupal\Core\Cache\CacheBackendInterface.
26 | ERROR | [x] Expected 1 blank line before function; 2 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...o\modules\fullcalendar_view\src\Plugin\views\style\FullCalendarDisplay.php
--------------------------------------------------------------------------------
FOUND 12 ERRORS AND 2 WARNINGS AFFECTING 11 LINES
--------------------------------------------------------------------------------
253 | ERROR | [x] Short array syntax must be used to define arrays
253 | ERROR | [x] Short array syntax must be used to define arrays
265 | ERROR | [x] Short array syntax must be used to define arrays
265 | ERROR | [x] Short array syntax must be used to define arrays
308 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
318 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
336 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
342 | ERROR | [x] Short array syntax must be used to define arrays
343 | ERROR | [x] Short array syntax must be used to define arrays
343 | ERROR | [x] Short array syntax must be used to define arrays
588 | ERROR | [x] Use null coalesce operator instead of ternary operator.
605 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: 'https://github.com/jakubroztocil/rrule'
681 | ERROR | [x] Use null coalesce operator instead of ternary operator.
721 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 13 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\drupalDemo\modules\fullcalendar_view\src\TaxonomyColor.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
--------------------------------------------------------------------------------
10 | WARNING | [ ] The class short comment should describe what the class does
| | and not simply repeat the class name
14 | ERROR | [ ] Missing member variable doc comment
47 | WARNING | [ ] Line exceeds 80 characters; contains 88 characters
47 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 9
49 | ERROR | [x] Use null coalesce operator instead of ternary operator.
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...\xampp\htdocs\drupalDemo\modules\fullcalendar_view\src\TimezoneService.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
7 | WARNING | The class short comment should describe what the class does and
| | not simply repeat the class name
--------------------------------------------------------------------------------

๐Ÿ“Œ Task
Status

Needs review

Version

5.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia priya_07_

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 @priya_07_
  • Assigned to sourabhjain
  • Merge request !60#3412058: Fix PHPCS issues โ†’ (Open) created by sourabhjain
  • Issue was unassigned.
  • Status changed to Needs work 6 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sourabhjain

    I have fixed most of the issues but still below are pending

    FILE: /Users/sourabhjain/www/drupal/modules/contrib/fullcalendar_view/css/jquery.qtip.min.css
    ---------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------
     1 | WARNING | File appears to be minified and cannot be processed
    ---------------------------------------------------------------------------------------------
    
    
    FILE: /Users/sourabhjain/www/drupal/modules/contrib/fullcalendar_view/css/fullcalendar.min.css
    ----------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------
     1 | WARNING | File appears to be minified and cannot be processed
    ----------------------------------------------------------------------------------------------
    
    
    FILE: /Users/sourabhjain/www/drupal/modules/contrib/fullcalendar_view/README.md
    -------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 14 WARNINGS AFFECTING 14 LINES
    -------------------------------------------------------------------------------
      16 | WARNING | Line exceeds 80 characters; contains 108 characters
      28 | WARNING | Line exceeds 80 characters; contains 203 characters
      29 | WARNING | Line exceeds 80 characters; contains 122 characters
      85 | WARNING | Line exceeds 80 characters; contains 159 characters
      91 | WARNING | Line exceeds 80 characters; contains 108 characters
      93 | WARNING | Line exceeds 80 characters; contains 148 characters
      95 | WARNING | Line exceeds 80 characters; contains 192 characters
      96 | WARNING | Line exceeds 80 characters; contains 88 characters
      98 | WARNING | Line exceeds 80 characters; contains 191 characters
     100 | WARNING | Line exceeds 80 characters; contains 225 characters
     124 | WARNING | Line exceeds 80 characters; contains 155 characters
     139 | WARNING | Line exceeds 80 characters; contains 106 characters
     152 | WARNING | Line exceeds 80 characters; contains 133 characters
     156 | WARNING | Line exceeds 80 characters; contains 113 characters
    -------------------------------------------------------------------------------
    
    
    FILE: /Users/sourabhjain/www/drupal/modules/contrib/fullcalendar_view/src/TimezoneService.php
    ----------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------
     7 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
    ----------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/sourabhjain/www/drupal/modules/contrib/fullcalendar_view/src/TaxonomyColor.php
    -----------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    -----------------------------------------------------------------------------------------------------------------
     10 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
     14 | ERROR   | Missing member variable doc comment
    -----------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/sourabhjain/www/drupal/modules/contrib/fullcalendar_view/src/FullcalendarViewPreprocess.php
    --------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
    --------------------------------------------------------------------------------------------------------
      12 | ERROR   | Doc comment is empty
      18 | ERROR   | Missing member variable doc comment
     304 | WARNING | Line exceeds 80 characters; contains 83 characters
    --------------------------------------------------------------------------------------------------------
    
    Time: 201ms; Memory: 12MB
    
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium BramDriesen Belgium ๐Ÿ‡ง๐Ÿ‡ช

    Did a quick review of what is present. Some things need to be cleaned up instead of being "fixed".

    Also note that no credit should be earned for just running PHPCBF or PHPCS reports.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Ashutosh Ahirwal India

    Ashutosh Ahirwal โ†’ made their first commit to this issueโ€™s fork.

  • Status changed to Needs review 6 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Ashutosh Ahirwal India

    Created a MR with phpcs fixes.
    Please review it.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium BramDriesen Belgium ๐Ÿ‡ง๐Ÿ‡ช

    This is an empty MR. Also please just add to the existing MR, in this case there is no reason to start a new one.

  • Status changed to Needs work 6 months ago
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium BramDriesen Belgium ๐Ÿ‡ง๐Ÿ‡ช

    BramDriesen โ†’ changed the visibility of the branch 3412058-phpcs-fixes to hidden.

  • Shruthi rao โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia zkhan.aamir

    Hi,

    MR #11 applied successfully.

    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules/contrib/fullcalendar_view (5.x)
    $ curl https://git.drupalcode.org/project/fullcalendar_view/-/merge_requests/60.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 33673    0 33673    0     0  86642      0 --:--:-- --:--:-- --:--:-- 87010
    patching file README.md
    patching file fullcalendar_view.module
    patching file fullcalendar_view.theme.inc
    patching file src/Annotation/FullcalendarViewProcessor.php
    patching file src/Controller/CalendarEventController.php
    patching file src/FullcalendarViewPreprocess.php
    Hunk #16 succeeded at 490 (offset 2 lines).
    Hunk #17 succeeded at 514 (offset 2 lines).
    patching file src/Plugin/FullcalendarViewProcessorBase.php
    patching file src/Plugin/FullcalendarViewProcessorManager.php
    patching file src/Plugin/views/style/FullCalendarDisplay.php
    Hunk #3 succeeded at 254 (offset 1 line).
    Hunk #4 succeeded at 266 (offset 1 line).
    Hunk #5 succeeded at 309 (offset 1 line).
    Hunk #6 succeeded at 319 (offset 1 line).
    Hunk #7 succeeded at 337 (offset 1 line).
    Hunk #8 succeeded at 601 (offset 13 lines).
    Hunk #9 succeeded at 618 (offset 13 lines).
    Hunk #10 succeeded at 649 (offset 13 lines).
    Hunk #11 succeeded at 694 (offset 13 lines).
    Hunk #12 succeeded at 734 (offset 13 lines).
    patching file src/TaxonomyColor.php
    patching file src/TimezoneService.php
    

    Still warning remaining.

    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules/contrib
    $ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,js,yml fullcalendar_view/
    
    FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\contrib\fullcalendar_view\src\Plugin\FullcalendarViewProcessorBase.php
    -------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------
     12 | WARNING | There must be no blank line following an inline comment
    -------------------------------------------------------------------------------------------------------------------------------
    
    Time: 632ms; Memory: 16MB
    
  • First commit to issue fork.
  • First commit to issue fork.
  • Status changed to Needs review 4 months ago
  • Status changed to Needs work 4 months ago
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium BramDriesen Belgium ๐Ÿ‡ง๐Ÿ‡ช

    As far as I can tell, nothing has been done with my MR feedback.

  • Status changed to Needs review 4 months ago
Production build 0.69.0 2024