Fix the issues reported by phpcs

Created on 21 February 2024, 9 months ago
Updated 16 August 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

Fixed

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan

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 Ahemdabad- Gujrat , Jodhpur - Rajsthan

    Fix The All phpcs issues please review it.

  • Status changed to Needs review 9 months ago
  • šŸ‡®šŸ‡³India prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan
  • Status changed to Needs work 9 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 India
  • šŸ‡®šŸ‡³India nitin_lama India

    No issues in the MR. Please review the MR1.

  • Status changed to Needs review 9 months ago
  • šŸ‡®šŸ‡³India nitin_lama India
  • šŸ‡®šŸ‡³India pray_12

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

  • Status changed to Needs work 9 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 pray_12

    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
    8 months ago
    Total: 178s
    #118070
  • Status changed to RTBC 8 months ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Pipeline finished with Skipped
    4 months ago
    #241422
  • First commit to issue fork.
  • šŸ‡«šŸ‡·France Kgaut

    Cheers, merged, creating a release soon.

  • Status changed to Fixed 4 months ago
  • šŸ‡«šŸ‡·France Kgaut
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024