Fix the issues reported by PHP_CodeSniffer

Created on 20 September 2024, 2 months ago

Problem/Motivation

FILE: content_readability\content_readability.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: content_readability\css\styles.css
-------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------
21 | ERROR | [x] Expected 1 space before opening brace of class definition; 0 found
-------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------

FILE: content_readability\README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
----------------------------------------------------------------------
4 | WARNING | Line exceeds 80 characters; contains 157 characters
13 | WARNING | Line exceeds 80 characters; contains 108 characters
17 | WARNING | Line exceeds 80 characters; contains 140 characters
----------------------------------------------------------------------

FILE: content_readability\src\Controller\ContentReadabilityAjaxController.php
---------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is DaveChild\TextStatistics\TextStatistics.
---------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------

FILE: content_readability\src\Controller\ContentReadabilityController.php
-------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------
8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Controller\ControllerBase.
-------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------

FILE: content_readability\src\Form\ContentReadabilityAddProfile.php
--------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactory.
--------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------

FILE: content_readability\src\Form\ContentReadabilityAdminSettingsForm.php
--------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactory.
--------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------

FILE: content_readability\src\Form\ContentReadabilityDeleteProfile.php
--------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactory.
--------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------

FILE: content_readability\src\Form\ContentReadabilityEditProfile.php
--------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactory.
--------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------

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

2.2

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
  • Status changed to Needs review 2 months ago
  • šŸ‡ŗšŸ‡øUnited States sunil jolapara 3265 Summitrun Drive, Independence, KY, 41051
  • šŸ‡®šŸ‡¹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.

  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi @zaryab_drupal,

    Thank you for providing an MR. I applied MR!13, it was applied smoothly and fixed most of the phpcs issues.

    These are the remaining issues after I ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml:

    āžœ  content_readability git:(2.2.0) curl https://git.drupalcode.org/project/content_readability/-/merge_requests/13.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  6359    0  6359    0     0  13648      0 --:--:-- --:--:-- --:--:-- 13704
    patching file README.md
    patching file css/styles.css
    patching file src/Controller/ContentReadabilityAjaxController.php
    patching file src/Controller/ContentReadabilityController.php
    patching file src/Form/ContentReadabilityAddProfile.php
    patching file src/Form/ContentReadabilityAdminSettingsForm.php
    patching file src/Form/ContentReadabilityDeleteProfile.php
    patching file src/Form/ContentReadabilityEditProfile.php
    āžœ  content_readability git:(2.2.0) āœ— ..
    āžœ  contrib git:(main) āœ— git status
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml content_readability
    
    FILE: /Users/interns/Demo-site/drupal_11_test/install-dir/drupal_11_test_site/web/modules/contrib/content_readability/content_readability.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: 361ms; Memory: 12MB
    
    āžœ  contrib git:(main) āœ—

    Please note that I cloned the module and did not download the module via composer.

    Thank you.

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

    @cleavinjosh Please review it, i have solved all codesniffer issues.

  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi @kul.pratap,

    Thank you for updating the MR. I applied MR!13, it was applied smoothly and fixed all the phpcs issues.

    āžœ  content_readability git:(2.2.0) curl https://git.drupalcode.org/project/content_readability/-/merge_requests/13.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 11386    0 11386    0     0  25537      0 --:--:-- --:--:-- --:--:-- 25529
    patching file README.md
    patching file content_readability.info.yml
    patching file css/styles.css
    patching file js/readability.js
    patching file js/readability_ckeditor4.js
    patching file src/Controller/ContentReadabilityAjaxController.php
    patching file src/Controller/ContentReadabilityController.php
    patching file src/Form/ContentReadabilityAddProfile.php
    patching file src/Form/ContentReadabilityAdminSettingsForm.php
    patching file src/Form/ContentReadabilityDeleteProfile.php
    patching file src/Form/ContentReadabilityEditProfile.php
    āžœ  content_readability git:(2.2.0) āœ— ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml content_readability
    āžœ  contrib git:(main) āœ—

    Thank you.

Production build 0.71.5 2024