Drupal Coding Standards Issues | phpcs

Created on 23 December 2022, over 2 years ago
Updated 3 August 2024, 8 months ago

Problem/Motivation

Getting following error/warnings

FILE: /app/modules/contrib/optional_end_date/config/schema/optional_end_date.schema.yml
---------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------
7 | ERROR | [x] Expected 1 newline at end of file; 0 found
---------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------

FILE: /app/modules/contrib/optional_end_date/optional_end_date.install
--------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------
39 | WARNING | [x] A comma should follow the last multiline array item. Found: 'daterange'
--------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------

Time: 1.08 secs; Memory: 10MB

Steps to reproduce

Run following command

phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/optional_end_date/

Proposed resolution

Above error/warnings need to be fixed

๐Ÿ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia samit.310@gmail.com

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

Merge Requests

Comments & Activities

Not all content is available!

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

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

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

  • Merge request !6resolved phpcs issues โ†’ (Merged) created by Unnamed author
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dev16.addweb

    Added patch(#2) changes and also resolve below mentioned phpcs issues in MR !6, please review.

    FILE: optional_end_date-3328949/src/Plugin/Field/FieldFormatter/OptionalEndDateDateRangePlainFormatter.php
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\datetime_range\Plugin\Field\FieldFormatter\DateRangePlainFormatter.
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: optional_end_date-3328949/src/Plugin/Field/FieldFormatter/OptionalEndDateDateRangeCustomFormatter.php
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\datetime_range\Plugin\Field\FieldFormatter\DateRangeCustomFormatter.
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: optional_end_date-3328949/src/Plugin/Field/FieldFormatter/OptionalEndDateDateRangeDefaultFormatter.php
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\datetime_range\Plugin\Field\FieldFormatter\DateRangeDefaultFormatter.
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: optional_end_date-3328949/src/Plugin/Field/FieldWidget/OptionalEndDateDateRangeDefaultWidget.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
    -------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: optional_end_date-3328949/src/Plugin/Field/FieldWidget/OptionalEndDateDateRangeDatelistWidget.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
    --------------------------------------------------------------------------------------------------------------------------------------------
    
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia riddhi.addweb

    The mentioned phpcs issue is resolved, & I have also checked and it is working as expected. I am attaching the Screenshots & doing RTBC for the same.

  • Status changed to RTBC 9 months ago
  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark Birk

    Merged, thanks all.

  • Status changed to Fixed 8 months ago
  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark Birk
Production build 0.71.5 2024