Fix the issues reported by phpcs

Created on 9 February 2023, about 2 years ago
Updated 27 April 2023, almost 2 years ago

Problem/Motivation

FILE: /Users/sahil.goyal/Documents/MySites/9.4.x/drupal/core/modules/node/node.module
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 18 ERRORS AND 3 WARNINGS AFFECTING 19 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
   59 | ERROR   | [ ] The array declaration extends to column 647 (the limit is 80). The array content should be split up over multiple lines
   65 | ERROR   | [ ] The array declaration extends to column 546 (the limit is 80). The array content should be split up over multiple lines
  158 | ERROR   | [ ] Missing parameter type
  178 | ERROR   | [ ] The array declaration extends to column 182 (the limit is 80). The array content should be split up over multiple lines
  334 | ERROR   | [ ] Return type missing for @return tag in function comment
  392 | ERROR   | [ ] Type hint "array" missing for $variables
  438 | WARNING | [x] There must be no blank line following an inline comment
  438 | WARNING | [ ] There must be no blank line following an inline comment
  448 | WARNING | [ ] There must be no blank line following an inline comment
  501 | ERROR   | [ ] Type hint "array" missing for $variables
  534 | ERROR   | [ ] The array declaration extends to column 169 (the limit is 80). The array content should be split up over multiple lines
  603 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  683 | ERROR   | [ ] Missing parameter type
  896 | ERROR   | [ ] Missing parameter type
  900 | ERROR   | [ ] Return type missing for @return tag in function comment
 1023 | ERROR   | [ ] Missing parameter type
 1056 | ERROR   | [ ] Missing parameter type
 1081 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 1129 | ERROR   | [ ] Type hint "array" missing for $context
 1183 | ERROR   | [ ] Type hint "array" missing for $results
 1183 | ERROR   | [ ] Type hint "array" missing for $operations
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------

Time: 237ms; Memory: 16MB

sahil.goyal@FVFH80ZQQ05P ~ % phpcbf --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml /Users/sahil.goyal/Documents/MySites/9.4.x/drupal/core/modules/node/node.module

PHPCBF RESULT SUMMARY
----------------------------------------------------------------------------------------------------
FILE                                                                                FIXED  REMAINING
----------------------------------------------------------------------------------------------------
/Users/sahil.goyal/Documents/MySites/9.4.x/drupal/core/modules/node/node.module     3      17
----------------------------------------------------------------------------------------------------
A TOTAL OF 3 ERRORS WERE FIXED IN 1 FILE
----------------------------------------------------------------------------------------------------

Time: 587ms; Memory: 22MB


sahil.goyal@FVFH80ZQQ05P ~ % phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml /Users/sahil.goyal/Documents/MySites/9.4.x/drupal/core/modules/node/node.module

FILE: /Users/sahil.goyal/Documents/MySites/9.4.x/drupal/core/modules/node/node.module
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 16 ERRORS AND 1 WARNING AFFECTING 16 LINES
------------------------------------------------------------------------------------------------------------------------------------------
   59 | ERROR   | The array declaration extends to column 647 (the limit is 80). The array content should be split up over multiple lines
   65 | ERROR   | The array declaration extends to column 546 (the limit is 80). The array content should be split up over multiple lines
  158 | ERROR   | Missing parameter type
  178 | ERROR   | The array declaration extends to column 182 (the limit is 80). The array content should be split up over multiple lines
  334 | ERROR   | Return type missing for @return tag in function comment
  392 | ERROR   | Type hint "array" missing for $variables
  447 | WARNING | There must be no blank line following an inline comment
  500 | ERROR   | Type hint "array" missing for $variables
  533 | ERROR   | The array declaration extends to column 169 (the limit is 80). The array content should be split up over multiple lines
  682 | ERROR   | Missing parameter type
  895 | ERROR   | Missing parameter type
  899 | ERROR   | Return type missing for @return tag in function comment
 1022 | ERROR   | Missing parameter type
 1055 | ERROR   | Missing parameter type
 1128 | ERROR   | Type hint "array" missing for $context
 1182 | ERROR   | Type hint "array" missing for $results
 1182 | ERROR   | Type hint "array" missing for $operations
------------------------------------------------------------------------------------------------------------------------------------------

Time: 226ms; Memory: 16MB

sahil.goyal@FVFH80ZQQ05P ~ % phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml /Users/sahil.goyal/Documents/MySites/9.4.x/drupal/core/modules/node/node.module 

FILE: /Users/sahil.goyal/Documents/MySites/9.4.x/drupal/core/modules/node/node.module
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 18 ERRORS AND 3 WARNINGS AFFECTING 19 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
   59 | ERROR   | [ ] The array declaration extends to column 647 (the limit is 80). The array content should be split up over multiple lines
   65 | ERROR   | [ ] The array declaration extends to column 546 (the limit is 80). The array content should be split up over multiple lines
  158 | ERROR   | [ ] Missing parameter type
  178 | ERROR   | [ ] The array declaration extends to column 182 (the limit is 80). The array content should be split up over multiple lines
  334 | ERROR   | [ ] Return type missing for @return tag in function comment
  392 | ERROR   | [ ] Type hint "array" missing for $variables
  438 | WARNING | [x] There must be no blank line following an inline comment
  438 | WARNING | [ ] There must be no blank line following an inline comment
  448 | WARNING | [ ] There must be no blank line following an inline comment
  501 | ERROR   | [ ] Type hint "array" missing for $variables
  534 | ERROR   | [ ] The array declaration extends to column 169 (the limit is 80). The array content should be split up over multiple lines
  603 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  683 | ERROR   | [ ] Missing parameter type
  896 | ERROR   | [ ] Missing parameter type
  900 | ERROR   | [ ] Return type missing for @return tag in function comment
 1023 | ERROR   | [ ] Missing parameter type
 1056 | ERROR   | [ ] Missing parameter type
 1081 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 1129 | ERROR   | [ ] Type hint "array" missing for $context
 1183 | ERROR   | [ ] Type hint "array" missing for $results
 1183 | ERROR   | [ ] Type hint "array" missing for $operations
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------

Time: 227ms; Memory: 16MB

sahil.goyal@FVFH80ZQQ05P ~ % clear

sahil.goyal@FVFH80ZQQ05P ~ % phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/date_all_day

FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/date_all_day/date_all_day.module
---------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------
 24 | ERROR | [x] Expected 1 newline at end of file; 2 found
---------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/date_all_day/date_all_day.views.inc
-----------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 1 WARNING AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------------------------------------------------------
 11 | 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."
 12 | ERROR   | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
 13 | ERROR   | [x] There must be exactly one blank line before the tags in a doc comment
 13 | ERROR   | [ ] The text '@deprecated ' does not match the standard format: @deprecated in %deprecation-version% and is removed from
    |         |     %removal-version%. %extra-info%.
 13 | ERROR   | [ ] Each @deprecated tag must have a @see tag immediately following it
-----------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/date_all_day/date_all_day.install
----------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------
  5 | ERROR   | [x] Doc comment short description must start with a capital letter
 15 | WARNING | [x] The variable name should be defined after the type
----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/date_all_day/src/Plugin/Field/FieldWidget/DatetimeRangeAllDayWidget.php
------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------------
 106 | WARNING | [x] A comma should follow the last multiline array item. Found: STORAGE_TIMEZONE
 121 | WARNING | [x] A comma should follow the last multiline array item. Found: STORAGE_TIMEZONE
------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/date_all_day/src/Plugin/Field/FieldType/DatetimeRangeAllDayItem.php
--------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 3 WARNINGS AFFECTING 4 LINES
--------------------------------------------------------------------------------------------------------------------------------------------
  5 | WARNING | [x] Unused use statement
  6 | WARNING | [x] Unused use statement
  7 | WARNING | [x] Unused use statement
 22 | ERROR   | [x] There should be no white space after an opening "{"
 22 | ERROR   | [x] There should be no white space before a closing "}"
--------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/date_all_day/src/Plugin/Field/FieldFormatter/DateRangeAllDayTrait.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
  30 | WARNING | [ ] Unused variable $item_value.
  47 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
 116 | ERROR   | [x] Expected 1 blank line after function; 0 found
 117 | ERROR   | [x] The closing brace for the trait must have an empty line before it
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/date_all_day/src/Plugin/Field/FieldFormatter/DateRangeAllDayCustomFormatter.php
--------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
--------------------------------------------------------------------------------------------------------------------------------------------------------
 32 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
 33 | ERROR | [x] Array closing indentation error, expected 4 spaces but found 6
 60 | ERROR | [x] Expected 1 blank line after function; 0 found
 61 | 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: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/date_all_day/src/Plugin/Field/FieldFormatter/DateRangeAllDayDefaultFormatter.php
---------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------------------------------------------
 33 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
 34 | ERROR | [x] Array closing indentation error, expected 4 spaces but found 6
---------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/date_all_day/src/Utility/DateRangeAllDayHelper.php
---------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------------
  5 | WARNING | [x] Unused use statement
 12 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
---------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------

Time: 140ms; Memory: 10MB

Steps to reproduce

Run the following cmd: phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml /Users/sahil.goyal/Documents/MySites/10.1.x/drupal/modules/contrib/date_all_day

Proposed resolution

Fix all the phpcs issues.

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

Closed: outdated

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia sahil.goyal

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue created by @sahil.goyal
  • Status changed to Needs review about 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sahil.goyal

    Resolving all the phpcs issues and updating the patch.

  • Assigned to sidharth_soman
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sidharth_soman Bangalore
  • Issue was unassigned.
  • Status changed to RTBC about 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sidharth_soman Bangalore

    #2 applied cleanly. It has resolved all errors. Hence, shifting this issue to RTBC.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Status changed to Needs work about 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    - * Implements hook_field_views_data().
    - * Copied from datetime_field_views_data().
    - * @deprecated
    + * Implements day all day field views data().

    The first line of the existing comment is correct. That is how hooks are documented.

    -            // formatter output and should not be rendered in the field template.
    +            // formatter output and should not be rendered in field template.

    The article is required. I think phpcs does not say to remove articles.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia rassoni Bangalore

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

  • Status changed to Needs review about 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia rassoni Bangalore

    Address #8 feedback.

  • @rashmisoni opened merge request.
  • Status changed to Needs work about 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    /**
      * @file
    - * date_all_day.install.
    + * Date_all_day.install.
      */

    Changing a lowercase letter to uppercase does not make the documentation comment correct. It still shows the filename, which is not the type of needed information.

    -  /** @var  $date_field */
    +  /** @var \Drupal\Core\Entity\EntityFieldManager $date_field*/

    There should be a space, before the comment delimiter.

     /**
      * Implements hook_field_views_data().
    - * Copied from datetime_field_views_data().
    - * @deprecated
      */

    @deprecated does not make sense for a hook implementation, so removing it is correct.
    Drupal coding standards allows an extra documentation comment, so removing the second line is wrong. The fact the hook has been copied from another hook is information useful for future maintainers.

     /**
    - * Class DateRangeAllDayHelper.
    + * Helper class for dealing with date and time range with all day.

    with all day is not a description for a range that is understandable. (What is a "with all day" range?)

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia rckstr_rohan

    Considering all the remarks on #12 and modifying the patch #10

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sahil.goyal

    Hi @rckstr_rohan, Please Upload Interdiff For the patch so changes would be visible

    Pleaes refere this : Interdiff โ†’

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia rckstr_rohan

    Attaching Interdiff file for patch #13 with #10

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    - * date_all_day.install.
    + * Date_all_day install file.

    That is not the correct comment for an installation file. It does not even use the correct module name.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia rckstr_rohan

    Thanks @apaderno for correction, uploading patch again.

  • Status changed to Needs review about 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sahil.goyal

    Hi @rckstr_rohan patch #17 is not being applied shown corrupted, attaching screenshot and updating the patch, Couldnโ€™t create interdiff as patch 17 having some malv, updating and patch and interdiff file with #9, Please Review.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    The patch in comment #17 seems fine, to me.

  • Status changed to Closed: outdated almost 2 years ago
  • ๐Ÿ‡ช๐Ÿ‡ธSpain akalam

    The coding standards have been addressed on the latest dev version, so this issue can be closed as outdated.

Production build 0.71.5 2024