Fix the issues reported by PHP_CodeSniffer

Created on 21 September 2024, 27 days ago

Problem/Motivation

FILE: field_display_toggle\field_display_toggle.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: field_display_toggle\field_display_toggle.module
--------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
4 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
17 | 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."
--------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------------

FILE: field_display_toggle\README.md
-----------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
-----------------------------------------------------------------------
14 | WARNING | Line exceeds 80 characters; contains 318 characters
31 | WARNING | Line exceeds 80 characters; contains 99 characters
32 | WARNING | Line exceeds 80 characters; contains 91 characters
33 | WARNING | Line exceeds 80 characters; contains 104 characters
34 | WARNING | Line exceeds 80 characters; contains 82 characters
-----------------------------------------------------------------------

Steps to reproduce

Run phpcs command to get the drupal coding standard issues.

Proposed resolution

Many of the issues can be fixed by running the phpcbf command. For the remaining ones, we will need to manually address and then commit these changes before pushing them.

šŸ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

šŸ‡ŗšŸ‡øUnited States sunil jolapara 3265 Summitrun Drive, Independence, KY, 41051

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

Merge Requests

Comments & Activities

  • Issue created by @sunil jolapara
  • Pipeline finished with Success
    27 days ago
    Total: 149s
    #288976
  • Status changed to Needs review 27 days ago
  • šŸ‡ŗšŸ‡øUnited States sunil jolapara 3265 Summitrun Drive, Independence, KY, 41051
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi

    I applied MR !2 but it didn't properly applied in the module and has 2 out of 2 hunks failed--saving rejects to field_display_toggle.module.rej

    āžœ  field_display_toggle git:(2.1.x) āœ— curl https://git.drupalcode.org/project/field_display_toggle/-/merge_requests/2.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  3087    0  3087    0     0   6348      0 --:--:-- --:--:-- --:--:--  6417
    patching file README.md
    patching file field_display_toggle.module
    2 out of 2 hunks failed--saving rejects to field_display_toggle.module.rej
    āžœ  field_display_toggle git:(2.1.x) āœ— ..
    āžœ  contrib git:(2.1.x) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml field_display_toggle
    
    FILE: ...rib/web/modules/contrib/field_display_toggle/field_display_toggle.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: ...ntrib/web/modules/contrib/field_display_toggle/field_display_toggle.module
    --------------------------------------------------------------------------------
    FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
    --------------------------------------------------------------------------------
      1 | ERROR   | [x] Missing file doc comment
      4 | ERROR   | [x] Use statements should be sorted alphabetically. The first
        |         |     wrong one is Drupal\Core\Form\FormStateInterface.
     17 | 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."
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    Time: 89ms; Memory: 10MB
    
    āžœ  contrib git:(2.1.x) āœ— 
    
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    The issue summary for PHP_CodeSniffer issues should always show the report given from PHP_CodeSniffer and the arguments passed to phpcs.

    Furthermore, since GitLab CI is now enabled for all the projects, GitLab CI should be used to get PHP_CodeSniffer errors/warnings.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • šŸ‡®šŸ‡³India kulpratap2002

    The latest version of the module (10.x-1.x) has no PHPCS errors; however, the version tagged as 1.0.2 does have errors. When installing the module, it is currently downloading version 1.0.2. For the new release, please merge the module with the latest version.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    The issue summary has not yet changed.

    Also, what can be changed is always a branch; already created releases cannot be changed, but a new release can be created, from an existing branch.

Production build 0.71.5 2024