Fix the issues reported by phpcs

Created on 13 April 2023, over 1 year ago

vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig web/modules/contrib/duet_date_picker/

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

FILE: /var/www/html/drupalvb/web/modules/contrib/duet_date_picker/src/Plugin/Field/FieldWidget/DuetDateRangePickerWidget.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 4 WARNINGS AFFECTING 6 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
70 | ERROR | The array declaration extends to column 101 (the limit is 80). The array content should be split up over multiple lines
71 | ERROR | The array declaration extends to column 99 (the limit is 80). The array content should be split up over multiple lines
106 | WARNING | Only string literals should be passed to t() where possible
112 | WARNING | Only string literals should be passed to t() where possible
216 | WARNING | Only string literals should be passed to t() where possible
222 | WARNING | Only string literals should be passed to t() where possible
-----------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/drupalvb/web/modules/contrib/duet_date_picker/src/Plugin/Field/FieldWidget/DuetDatePickerWidget.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
53 | ERROR | [x] No space found before comment text; expected "// $element[$date_picker_element_name] = $element['value'];" but found "//$element[$date_picker_element_name] = $element['value'];"
75 | ERROR | [ ] The array declaration extends to column 95 (the limit is 80). The array content should be split up over multiple lines
85 | WARNING | [ ] Only string literals should be passed to t() where possible
181 | WARNING | [ ] Only string literals should be passed to t() where possible
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/drupalvb/web/modules/contrib/duet_date_picker/src/Plugin/Validation/Constraint/NoPastDatesConstraint.php
----------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------
18 | ERROR | Missing short description in doc comment
----------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/drupalvb/web/modules/contrib/duet_date_picker/src/Plugin/Validation/Constraint/NoPastDatesConstraintValidator.php
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------------------------------
18 | WARNING | Unused variable $delta.
38 | ERROR | Parameter tags must be grouped together in a doc comment
-------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/drupalvb/web/modules/contrib/duet_date_picker/duet_date_picker.module
-----------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
-----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------

FILE: /var/www/html/drupalvb/web/modules/contrib/duet_date_picker/duet_date_picker.info.yml
-----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
-----------------------------------------------------------------------------------------------------------

FILE: /var/www/html/drupalvb/web/modules/contrib/duet_date_picker/ci/templates/release.package.yml
--------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------
90 | ERROR | [x] Expected 1 newline at end of file; 2 found
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------

FILE: /var/www/html/drupalvb/web/modules/contrib/duet_date_picker/README.md
---------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
---------------------------------------------------------------------------
6 | WARNING | [ ] Line exceeds 80 characters; contains 83 characters
29 | WARNING | [ ] Line exceeds 80 characters; contains 353 characters
31 | ERROR | [x] Expected 1 newline at end of file; 2 found
---------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------

Time: 753ms; Memory: 12MB

๐Ÿ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia dineshkumarbollu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @dineshkumarbollu
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines paraderojether

    Hi @dineshkumarbollu

    I reviewed patch #2 and there are still remaining phpcs warnings shown below.

    FILE: /Users/studenttrainees/Drupal2/drupalsite/docroot/modules/duet_date_picker/duet_date_picker.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: ...rupal2/drupalsite/docroot/modules/duet_date_picker/src/Plugin/Validation/Constraint/NoPastDatesConstraintValidator.php
    ----------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------
    18 | WARNING | Unused variable $delta.
    ----------------------------------------------------------------------------------------------------------------------------

    Please check.
    Thank You.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia chanderbhushan

    Added patch for fix

  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    +/**
    + * @file
    + */
    +

    Just adding a @file tag is not sufficient. The short description is still missing.

    The last patch is not even complete, since it does not fix all the issues the report listed.

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

    Furthermore, if I run the command shown in the issue summary, I get a different report. Those are the issues to be fixed for the 1.0.x branch.

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

    Created a patch for resolving the PHPCS issue as mentioned in #8. Please review.

    Issues on running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig even after applying patch.

    FILE: /home/administrator/Projects/duet_date_picker/README.md
    ------------------------------------------------------------------------
    FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
    ------------------------------------------------------------------------
      6 | WARNING | [ ] Line exceeds 80 characters; contains 83 characters
     29 | WARNING | [ ] Line exceeds 80 characters; contains 353 characters
     31 | ERROR   | [x] Expected 1 newline at end of file; 2 found
    ------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------
    
    
    FILE: /home/administrator/Projects/duet_date_picker/duet_date_picker.module
    ---------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------
     3 | ERROR | Missing short description in doc comment
    ---------------------------------------------------------------------------
    
    
    FILE: /home/administrator/Projects/duet_date_picker/src/Plugin/Field/FieldWidget/DuetDatePickerWidget.php
    ----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
    ----------------------------------------------------------------------------------------------------------------------------------------
      75 | ERROR   | The array declaration extends to column 95 (the limit is 80). The array content should be split up over multiple lines
      85 | WARNING | Only string literals should be passed to t() where possible
     181 | WARNING | Only string literals should be passed to t() where possible
    ----------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/administrator/Projects/duet_date_picker/src/Plugin/Field/FieldWidget/DuetDateRangePickerWidget.php
    -----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AND 4 WARNINGS AFFECTING 6 LINES
    -----------------------------------------------------------------------------------------------------------------------------------------
      70 | ERROR   | The array declaration extends to column 101 (the limit is 80). The array content should be split up over multiple lines
      71 | ERROR   | The array declaration extends to column 99 (the limit is 80). The array content should be split up over multiple lines
     106 | WARNING | Only string literals should be passed to t() where possible
     112 | WARNING | Only string literals should be passed to t() where possible
     216 | WARNING | Only string literals should be passed to t() where possible
     222 | WARNING | Only string literals should be passed to t() where possible
    -----------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/administrator/Projects/duet_date_picker/src/Plugin/Validation/Constraint/NoPastDatesConstraint.php
    --------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------
     18 | ERROR | Missing short description in doc comment
    --------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/administrator/Projects/duet_date_picker/src/Plugin/Validation/Constraint/NoPastDatesConstraintValidator.php
    -----------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------
     18 | WARNING | Unused variable $delta.
    -----------------------------------------------------------------------------------------------------------------------
    
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    +/**
    + * @file
    + * Contains custom functions for Duet Date Picker Module.
    + */
    +

    The short description for the module is Hook implementations for the Duet Date Picker module.
    Module is only used when it is the first word in a sentence; otherwise, it is module.

    -    $element[$date_picker_element_name]['#date_date_callbacks'][] = [$this, 'dateDateCallback'];
    +    $element[$date_picker_element_name]['#date_date_callbacks'][] =
    +      [$this, 'dateDateCallback'];

    Coding standards do not say that lines must be shorter than 81 characters, That is an example of line that is better to be left as it is.

    -      '#default_value' => $this->t($this->getSetting('label')),
    +      '#default_value' => $this->t('@label', ['@label' => $this->getSetting('label')]),
           '#required' => TRUE,

    That code does not translate the label. That is one of the case where either $this->getSetting('label') is passed to $this->t() or $this->t() is not used.

  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia mrinalini9 New Delhi

    Updated patch #9 by addressing #10, please review it.

    Thanks!

  • Hi,Reviewed the patch provided at #11 , it could not be applied. Attaching the screenshot for reference.
    Thanks!

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

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

  • Pipeline finished with Failed
    5 months ago
    Total: 31s
    #210749
  • Merge request !5Fixed phpcs issues. โ†’ (Open) created by Unnamed author
  • Pipeline finished with Failed
    5 months ago
    Total: 61s
    #210761
  • Status changed to Needs work 4 months ago
  • Hi @mrinalini9,

    Applied the patch you provided, the patch was applied not-so successfully, might be the reason it resulted to the reported errors. Please see below:

    duet_date_picker git:(1.0.x) curl https://www.drupal.org/files/issues/2023-04-24/phpcs-3353923-11.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  9686  100  9686    0     0  39694      0 --:--:-- --:--:-- --:--:-- 41042
    patching file README.md
    patching file ci/templates/release.package.yml
    patching file config/schema/duet_date_picker.schema.yml
    patching file duet_date_picker.info.yml
    Hunk #1 FAILED at 1.
    1 out of 1 hunk FAILED -- saving rejects to file duet_date_picker.info.yml.rej
    patching file duet_date_picker.module
    patching file src/Plugin/Field/FieldWidget/DuetDatePickerWidget.php
    patching file src/Plugin/Field/FieldWidget/DuetDateRangePickerWidget.php
    patching file src/Plugin/Validation/Constraint/NoPastDatesConstraint.php
    patching file src/Plugin/Validation/Constraint/NoPastDatesConstraintValidator.php
    โžœ  duet_date_picker git:(1.0.x) โœ— cd ..
    โžœ  contrib git:(master) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig duet_date_picker
    
    FILE: ...orgissue-v9/web/modules/contrib/duet_date_picker/duet_date_picker.info.yml
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     1 | WARNING | Remove "version" from the info file, it will be added by
       |         | drupal.org packaging automatically
    --------------------------------------------------------------------------------
    
    
    FILE: ...rgissue-v9/web/modules/contrib/duet_date_picker/duet_date_picker.views.inc
    --------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    --------------------------------------------------------------------------------
      1 | ERROR | [x] Missing file doc comment
     12 | ERROR | [x] Whitespace found at end of line
     27 | ERROR | [x] Expected 1 newline at end of file; 2 found
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...rib/duet_date_picker/src/Plugin/Field/FieldWidget/DuetDatePickerWidget.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is Drupal\Core\Datetime\DrupalDateTime.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...uet_date_picker/src/Plugin/Field/FieldWidget/DuetDateRangePickerWidget.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is Drupal\Core\Datetime\DrupalDateTime.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: .../modules/contrib/duet_date_picker/src/Plugin/views/filter/DuetDateTime.php
    --------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
      6 | ERROR | [x] Use statements should be sorted alphabetically. The first
        |       |     wrong one is Drupal\Core\Form\FormStateInterface.
     74 | ERROR | [x] Use "elseif" in place of "else if"
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: .../web/modules/contrib/duet_date_picker/src/Plugin/views/filter/DuetDate.php
    --------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
      6 | ERROR | [x] Use statements should be sorted alphabetically. The first
        |       |     wrong one is Drupal\Core\Form\FormStateInterface.
     74 | ERROR | [x] Use "elseif" in place of "else if"
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    Time: 343ms; Memory: 12MB

    Kindly check

    Thanks,
    Jake

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada minoroffense Ottawa, Canada

    Thanks for the work. I finish it up and set the attribution in the commit for everyone.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024