Fix the issues reported by phpcs

Created on 8 July 2024, 2 months ago
Updated 25 July 2024, about 1 month ago

Problem/Motivation

Command -: vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig modules/contrib/cache_control_headers/

FILE: /var/www/html/drupal-contri-d10/modules/contrib/cache_control_headers/README.md
-------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------
 3 | WARNING | Line exceeds 80 characters; contains 313 characters
-------------------------------------------------------------------------------------


FILE: /var/www/html/drupal-contri-d10/modules/contrib/cache_control_headers/cache_control_headers.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: 106ms; Memory: 10MB

Steps to reproduce

Run PHPCS on Config Pages 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 bhaveshdas

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 @bhaveshdas
  • Status changed to Needs review 2 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia bhaveshdas

    I have fixed all phpcs issues could you please review it.

    Thanktou !

  • Status changed to Needs work 2 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines cleavinjosh

    Hi @bhaveshdas,

    I applied MR!1 and I encountered an error.

    โžœ  cache_control_headers git:(main) โœ— curl https://git.drupalcode.org/project/cache_control_headers/-/merge_requests/1.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  1702    0  1702    0     0   4346      0 --:--:-- --:--:-- --:--:--  4352
    patching file README.md
    patching file src/EventSubscriber/CacheControlResponseSubscriber.php
    Hunk #1 FAILED at 2.
    1 out of 1 hunk FAILED -- saving rejects to file src/EventSubscriber/CacheControlResponseSubscriber.php.rej
    โžœ  cache_control_headers git:(main) โœ—

    Please check and advise.
    Thank you.

  • Issue was unassigned.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dev2.addweb

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

  • Merge request !2Fixed phpcs issue. โ†’ (Open) created by Unnamed author
  • Status changed to Needs review about 2 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dev2.addweb

    Hello,

    Try this MR !2 using the (1.0.x-dev) version.

  • Status changed to Needs work about 2 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines cleavinjosh

    Hi @nilesh.addweb,

    I applied MR!2 on 1.0.x-dev and it was applied smoothly. However I still encountered an issue after I ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml.

    โžœ  cache_control_headers git:(1.0.x) curl https://git.drupalcode.org/project/cache_control_headers/-/merge_requests/2.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   963    0   963    0     0   2620      0 --:--:-- --:--:-- --:--:--  2616
    patching file README.md
    โžœ  cache_control_headers git:(1.0.x) โœ— ..
    โžœ  contrib git:(main) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml cache_control_headers
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/cache_control_headers/src/EventSubscriber/CacheControlResponseSubscriber.php
    -------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Cache\CacheableResponseInterface.
    -------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 190ms; Memory: 10MB
    
    โžœ  contrib git:(main) โœ—

    Thank you.

  • Status changed to Needs review about 2 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dev2.addweb

    I have updated MR !2 and fixed phpcs issue mention in #9. Please review it.

  • Status changed to RTBC about 1 month ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines cleavinjosh

    Hi @nilesh.addweb,

    I applied MR!2, it was applied smoothly and fixed the phpcs issue in comment #9.

    โžœ  cache_control_headers git:(1.0.x) curl https://git.drupalcode.org/project/cache_control_headers/-/merge_requests/2.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  1699    0  1699    0     0   2380      0 --:--:-- --:--:-- --:--:--  2379
    patching file README.md
    patching file src/EventSubscriber/CacheControlResponseSubscriber.php
    โžœ  cache_control_headers git:(1.0.x) โœ— ..
    โžœ  contrib phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml cache_control_headers
    โžœ  contrib

    I will now move the status to Reviewed and tested by the community
    Thank you.

Production build 0.71.5 2024