Fix the issues reported by phpcs

Created on 10 October 2023, 9 months ago
Updated 14 June 2024, 10 days ago

Problem/Motivation
FILE: C:\wamp64\www\my_learning_site\web\modules\contrib\block_class\js\block-class.js
-------------------------------------------------------------------------------------------------
FOUND 25 ERRORS AFFECTING 25 LINES
-------------------------------------------------------------------------------------------------
49 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
66 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
87 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
92 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
100 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
104 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
120 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
145 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
152 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
172 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
201 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
209 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
233 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
250 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
262 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
283 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
291 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
302 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
307 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
318 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
323 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
343 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
348 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
354 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
359 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
-------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 25 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------

FILE: C:\wamp64\www\my_learning_site\web\modules\contrib\block_class\src\Controller\BlockClassController.php
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------
9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
-----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------

FILE: C:\wamp64\www\my_learning_site\web\modules\contrib\block_class\src\Form\BlockClassBulkOperationsForm.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------
11 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Extension\ExtensionList.
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------

FILE: C:\wamp64\www\my_learning_site\web\modules\contrib\block_class\src\Form\BlockClassConfirmBulkOperationForm.php
--------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------
8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\block\Entity\Block.
--------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------

FILE: C:\wamp64\www\my_learning_site\web\modules\contrib\block_class\src\Form\BlockClassConfirmDeletionAttributeForm.php
------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------
8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\block\Entity\Block.
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

FILE: C:\wamp64\www\my_learning_site\web\modules\contrib\block_class\src\Form\BlockClassConfirmDeletionForm.php
-------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------
8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\block\Entity\Block.
-------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------

FILE: C:\wamp64\www\my_learning_site\web\modules\contrib\block_class\src\Form\BlockClassSettingsForm.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------
8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Extension\ExtensionList.
-----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------

FILE: C:\wamp64\www\my_learning_site\web\modules\contrib\block_class\src\Service\BlockClassHelperService.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------
11 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Database\Connection.
606 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
-----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------

FILE: C:\wamp64\www\my_learning_site\web\modules\contrib\block_class\tests\src\Functional\BlockClassTest.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\StringTranslation\StringTranslationTrait.
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------
Steps to reproduce
Install Block Class module and perform PHPCS for Drupal Standards

Execute the command: phpcs --standard=drupal,drupalpractice block_class/

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇮🇳India shalini_jha

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @shalini_jha
  • Issue was unassigned.
  • Status changed to Needs review 9 months ago
  • 🇮🇳India shalini_jha

    i have fixed the all reported issue and added patch for this.

  • Status changed to Needs work 9 months ago
  • 🇵🇭Philippines clarkssquared

    Hi,

    I applied and tested tthe patch #2 and I saw that there are still PHPCS issues being flagged, for convenience please refer below.

     block_class git:(master) ✗ curl https://www.drupal.org/files/issues/2023-10-10/Fix-the-issues-reported-by-phpcs-3392942%232.patch | patch -p1  
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 17997  100 17997    0     0  59392      0 --:--:-- --:--:-- --:--:-- 60595
    patching file block_class.services.yml
    patching file 'js/block-class.js'
    patching file 'src/Controller/BlockClassController.php'
    patching file 'src/Form/BlockClassBulkOperationsForm.php'
    patching file 'src/Form/BlockClassConfirmBulkOperationForm.php'
    patching file 'src/Form/BlockClassConfirmDeletionAttributeForm.php'
    patching file 'src/Form/BlockClassConfirmDeletionForm.php'
    patching file 'src/Form/BlockClassSettingsForm.php'
    patching file 'src/Service/BlockClassHelperService.php'
    patching file 'tests/src/Functional/BlockClassTest.php'
    ➜  block_class git:(master) ✗ ..
    ➜  contrib git:(master) ✗ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml block_class 
    
    FILE: ...ng/Projects/d9/d9-local/web/modules/contrib/block_class/block_class.module
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     10 | ERROR | [x] Use statements should be sorted alphabetically. The first
        |       |     wrong one is Drupal\block\BlockInterface.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: .../Projects/d9/d9-local/web/modules/contrib/block_class/block_class.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
    --------------------------------------------------------------------------------
    
    Time: 979ms; Memory: 18MB
    
    
  • Assigned to shalini_jha
  • 🇮🇳India shalini_jha

    I am checking

  • Issue was unassigned.
  • Status changed to Needs review 9 months ago
  • 🇮🇳India shalini_jha

    Added a patch for the remaining phpcs issues.

  • Status changed to RTBC 9 months ago
  • Status changed to Fixed 9 months ago
  • Status changed to RTBC 9 months ago
  • 🇧🇷Brazil RenatoG Campinas

    Actually I think it wasn’t fixed since the patch wasn’t committed, right?

    Moving back the previous status

  • 🇮🇳India Gautam_105@

    @renatog,
    i have fixed this issue and created MR for the same. Please review and see ascreenshot as well.

  • Merge request !27Resolve #3392942 "Fix the issues" → (Merged) created by Gautam_105@
  • Status changed to Needs work 8 months ago
  • 🇧🇷Brazil RenatoG Campinas

    Thanks @gautam_105

    But I think the MR wasn't created correctly, right?

    Please take a look

  • 🇮🇳India Gautam_105@

    @renatog ,
    i have updated my MR Please review MR.

  • Status changed to Needs review 8 months ago
  • First commit to issue fork.
  • Status changed to Fixed 24 days ago
  • 🇫🇷France DYdave

    The changes have been merged!

    Build pipeline passed: https://git.drupalcode.org/project/block_class/-/pipelines/186710
    PHPCS job passed: https://git.drupalcode.org/project/block_class/-/jobs/1734340

    Thanks everyone for the great help and work!

  • 🇫🇷France DYdave
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024