Fix the issues reported by phpcs

Created on 1 March 2023, almost 2 years ago
Updated 21 August 2024, 4 months ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/block_country/README.txt
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
64 | ERROR | [x] Expected 1 newline at end of file; 2 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/block_country/block_country.info.yml
-----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
-----------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/block_country/src/Plugin/Condition/BlockCountry.php
----------------------------------------------------------------------------------------------
FOUND 13 ERRORS AFFECTING 12 LINES
----------------------------------------------------------------------------------------------
53 | ERROR | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
91 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "True"
113 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "False"
114 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "True"
115 | ERROR | [x] Expected newline after closing brace
117 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
119 | ERROR | [x] Expected 1 space after closing parenthesis; found 2
120 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
122 | ERROR | [x] Expected newline after closing brace
123 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
134 | ERROR | [x] Expected 1 blank line after function; 2 found
141 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
141 | ERROR | [x] Short array syntax must be used to define arrays
----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 13 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------

Time: 1.16 secs; Memory: 6MB

Steps to reproduce

Run following command

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/block_country/

Proposed resolution

Above error/warnings need to be fixed.

๐Ÿ“Œ Task
Status

Needs review

Version

2.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia samit.310@gmail.com

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 @samit.310@gmail.com
  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia samit.310@gmail.com

    Above error/warnings are fixed.

    Here not covering README.txt's errors/warnings as following issue is there.

    Replace README.txt with README.md โ†’

  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sourabhjain

    When I am trying to apply the patch #2 for 2.0.0 branch, getting attached error

  • Status changed to Needs review almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sourabhjain

    Fixed the more issue. Please review it now.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sourabhjain

    Sorry I have uploaded the text patch file in #4. Uploading it again.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia rajneeshb New Delhi

    Reviewed #5 All coding standard issues fixed. Looks good, +1RTBC
    Attaching screenshots for the same.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia rassoni Bangalore

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

  • Merge request !13345116- Fixed coding standard. โ†’ (Open) created by Unnamed author
  • Hi @everyone,

    Applied the commit made on MR!1 that I guess was from the patch, it was applied not-so successfully that might be the reason one error was still reported. Please see below:

    โžœ  block_country git:(master) โœ— curl https://git.drupalcode.org/project/block_country/-/merge_requests/1.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  3462    0  3462    0     0   9755      0 --:--:-- --:--:-- --:--:-- 10182
    patching file README.txt
    patching file block_country.info.yml
    Hunk #1 FAILED at 2.
    1 out of 1 hunk FAILED -- saving rejects to file block_country.info.yml.rej
    patching file src/Plugin/Condition/BlockCountry.php
    โžœ  block_country git:(master) โœ— ..
    โžœ  contrib git:(master) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig block_country
    
    FILE: /Users/PrometInterns/Demo-site/drupal-orgissue-v9/web/modules/contrib/block_country/src/Plugin/Condition/BlockCountry.php
    -------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------
     11 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Cache\Cache.
    -------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------
    
    Time: 191ms; Memory: 10MB
  • Status changed to Needs work 4 months ago
  • First commit to issue fork.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia chandansha

    i have fixed #11 listed issues. Find and resolve issues which is provided command in #11.

  • Status changed to Needs review 4 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Pipeline finished with Failed
    4 months ago
    Total: 42s
    #260081
Production build 0.71.5 2024