Fix the issues reported by phpcs

Created on 21 February 2024, 4 months ago
Updated 13 March 2024, 3 months ago

Problem/Motivation

There is a files need to fixed with coding standards.
Here is the command : -
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,twig modules/contrib/database_dashboard/

Result : -

FILE: /home/prem/Documents/drupal11/modules/custom/database_dashboard/src/Controller/DatabaseDashboardController.php
--------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------------------------------------------
 44 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
 44 | ERROR   | [x] Expected one space after the comma, 0 found
 63 | ERROR   | [x] Expected 1 space before "=>"; 0 found
 65 | WARNING | [x] A comma should follow the last multiline array item. Found: 'database_dashboard/dashboard'
--------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------


FILE: /home/prem/Documents/drupal11/modules/custom/database_dashboard/database_dashboard.module
-----------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------
 1 | ERROR | [x] Missing file doc comment
-----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------


FILE: /home/prem/Documents/drupal11/modules/custom/database_dashboard/database_dashboard.info.yml
-------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------
 7 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
-------------------------------------------------------------------------------------------------

Time: 67ms; Memory: 10MB

Steps to reproduce

Run PHPCS on database_dashboard module.

Proposed resolution

Fixed the coding standards.

Remaining tasks

Submit the patch either MR .

šŸ“Œ Task
Status

RTBC

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India Prem Suthar gujrat

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

Merge Requests

Comments & Activities

  • Issue created by @Prem Suthar
  • šŸ‡®šŸ‡³India Prem Suthar gujrat

    Fix The All phpcs issues please review it.

  • Status changed to Needs review 4 months ago
  • šŸ‡®šŸ‡³India Prem Suthar gujrat
  • Status changed to Needs work 4 months ago
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi

    I applied your patch #2 and it didn't apply properly and there are still PHPCS issues being flagged.

    āžœ  database_dashboard git:(master) āœ— curl https://www.drupal.org/files/issues/2024-02-21/3422911-2.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2297  100  2297    0     0   3570      0 --:--:-- --:--:-- --:--:--  3605
    patching file database_dashboard.info.yml
    1 out of 1 hunks failed--saving rejects to database_dashboard.info.yml.rej
    patching file database_dashboard.module
    patching file 'src/Controller/DatabaseDashboardController.php'
    āžœ  database_dashboard git:(master) āœ— ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml database_dashboard 
    
    FILE: /Users/clarksubing-subing/Projects/d9/d9-local/web/modules/contrib/database_dashboard/css/dashboard.css
    -------------------------------------------------------------------------------------------------------------
    FOUND 9 ERRORS AFFECTING 6 LINES
    -------------------------------------------------------------------------------------------------------------
      2 | ERROR | [x] Selectors must be on a single line
      3 | ERROR | [x] Multiple selectors should each be on a single line
      3 | ERROR | [x] Selectors must be on a single line
      4 | ERROR | [x] Selectors must be on a single line
      5 | ERROR | [x] Multiple selectors should each be on a single line
      5 | ERROR | [x] Selectors must be on a single line
      6 | ERROR | [ ] Style definitions must end with a semicolon
     18 | ERROR | [x] There must be no space before a colon in a style definition
     18 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
    -------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------
    
    
    FILE: ...rs/clarksubing-subing/Projects/d9/d9-local/web/modules/contrib/database_dashboard/database_dashboard.info.yml
    -------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 2 LINES
    -------------------------------------------------------------------------------------------------------------------
     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
     7 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
    -------------------------------------------------------------------------------------------------------------------
    
    Time: 284ms; Memory: 10MB
    
    āžœ  contrib git:(master) āœ— 
    
  • šŸ‡®šŸ‡³India nitin_lama

    No issues in the MR. Please review the MR1.

  • Status changed to Needs review 4 months ago
  • šŸ‡®šŸ‡³India Preethy_ray

    Hi,
    Applied the MR!1,found no phpcs errors and warnings.

  • Status changed to Needs work 4 months ago
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi

    I applied MR !1 again and I can still see some PHPCS errors

    āžœ  database_dashboard git:(master) āœ— curl https://git.drupalcode.org/project/database_dashboard/-/merge_requests/1.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2495    0  2495    0     0   5172      0 --:--:-- --:--:-- --:--:--  5286
    patching file database_dashboard.info.yml
    1 out of 1 hunks failed--saving rejects to database_dashboard.info.yml.rej
    patching file database_dashboard.module
    patching file 'src/Controller/DatabaseDashboardController.php'
    āžœ  database_dashboard git:(master) āœ— ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml database_dashboard 
    
    FILE: ...jects/d9/d9-local/web/modules/contrib/database_dashboard/css/dashboard.css
    --------------------------------------------------------------------------------
    FOUND 9 ERRORS AFFECTING 6 LINES
    --------------------------------------------------------------------------------
      2 | ERROR | [x] Selectors must be on a single line
      3 | ERROR | [x] Multiple selectors should each be on a single line
      3 | ERROR | [x] Selectors must be on a single line
      4 | ERROR | [x] Selectors must be on a single line
      5 | ERROR | [x] Multiple selectors should each be on a single line
      5 | ERROR | [x] Selectors must be on a single line
      6 | ERROR | [ ] Style definitions must end with a semicolon
     18 | ERROR | [x] There must be no space before a colon in a style definition
     18 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...9-local/web/modules/contrib/database_dashboard/database_dashboard.info.yml
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
     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
     7 | WARNING | All dependencies must be prefixed with the project name, for
       |         | example "drupal:"
    --------------------------------------------------------------------------------
    
    Time: 200ms; Memory: 10MB
    
    āžœ  contrib git:(master) āœ— 
    
  • šŸ‡®šŸ‡³India Preethy_ray

    hi ,
    @clarkssquared Please use this command
    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,twig modules/contrib/database_dashboard/

  • First commit to issue fork.
  • Pipeline finished with Success
    3 months ago
    Total: 178s
    #118070
  • Status changed to RTBC 3 months ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
Production build 0.69.0 2024