Fix the issues reported by phpcs

Created on 20 January 2023, almost 2 years ago
Updated 17 July 2024, 5 months ago

Problem/Motivation

FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\contrib\dl_file\src\Commands\DlFileCommands.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 161 ERRORS AND 1 WARNING AFFECTING 85 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
  19 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 5
  19 | ERROR   | [ ] Missing short description in doc comment
  19 | ERROR   | [ ] Parameter $options is not described in comment
  20 | ERROR   | [x] Expected 6 space(s) before asterisk; 5 found
  20 | ERROR   | [x] Expected "string" but found "String" for parameter type
  21 | ERROR   | [x] Expected 6 space(s) before asterisk; 5 found
  22 | ERROR   | [x] Doc comment star missing
  23 | ERROR   | [x] Expected 6 space(s) before asterisk; 5 found
  24 | ERROR   | [x] Expected 6 space(s) before asterisk; 5 found
  25 | ERROR   | [x] Doc comment star missing
  26 | ERROR   | [x] Expected 6 space(s) before asterisk; 5 found
  27 | ERROR   | [x] Expected 6 space(s) before asterisk; 5 found
  28 | ERROR   | [x] Doc comment star missing
  29 | ERROR   | [x] Expected 6 space(s) before asterisk; 5 found
  30 | ERROR   | [x] Expected 6 space(s) before asterisk; 5 found
  31 | ERROR   | [x] Doc comment star missing
  32 | ERROR   | [x] Expected 6 space(s) before asterisk; 5 found
  33 | ERROR   | [x] Expected 6 space(s) before asterisk; 5 found
  34 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  34 | ERROR   | [x] Expected 1 blank line before function; 0 found
  34 | ERROR   | [x] Expected 0 spaces before opening parenthesis; 1 found
  34 | ERROR   | [ ] The array declaration extends to column 136 (the limit is 80). The array content should be split up over multiple lines
  34 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  34 | ERROR   | [x] Expected 1 space between comma and "'info'"; 0 found
  34 | ERROR   | [x] Expected one space after the comma, 0 found
  34 | ERROR   | [x] Expected 1 space between double arrow and "false"; 0 found
  34 | ERROR   | [x] Expected 1 space after "=>"; 0 found
  34 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  34 | ERROR   | [x] There should be no white space before a closing ")"
  34 | ERROR   | [x] Expected 0 spaces before closing parenthesis; 1 found
  35 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  35 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
  36 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
  37 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
  37 | ERROR   | [x] Concat operator must be surrounded by a single space
  38 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
  38 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
  39 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 16
  39 | ERROR   | [x] Concat operator must be surrounded by a single space
  39 | ERROR   | [x] Concat operator must be surrounded by a single space
  40 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 16
  41 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 16
  41 | ERROR   | [x] Concat operator must be surrounded by a single space
  41 | ERROR   | [x] Concat operator must be surrounded by a single space
  42 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 16
  43 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 16
  44 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 16
  44 | ERROR   | [x] Inline comments must start with a capital letter
  45 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 16
  45 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  46 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 16
  47 | ERROR   | [x] Object operator not indented correctly; expected 18 spaces but found 20
  51 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 16
  51 | ERROR   | [x] Inline comments must start with a capital letter
  52 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 16
  53 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 16
  54 | ERROR   | [x] Concat operator must be surrounded by a single space
  54 | ERROR   | [x] Concat operator must be surrounded by a single space
  56 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 16
  56 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
  57 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 20
  59 | ERROR   | [x] Concat operator must be surrounded by a single space
  59 | ERROR   | [x] Concat operator must be surrounded by a single space
  59 | ERROR   | [x] Concat operator must be surrounded by a single space
  59 | ERROR   | [x] Concat operator must be surrounded by a single space
  61 | ERROR   | [x] Line indented incorrectly; expected -10 spaces, found 20
  61 | ERROR   | [x] Short array syntax must be used to define arrays
  62 | ERROR   | [x] Line indented incorrectly; expected -10 spaces, found 20
  62 | ERROR   | [x] Expected 1 space before "="; 0 found
  62 | ERROR   | [x] Expected 1 space after "="; 0 found
  63 | ERROR   | [x] Line indented incorrectly; expected -10 spaces, found 20
  64 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  65 | ERROR   | [x] Line indented incorrectly; expected -10 spaces, found 20
  65 | ERROR   | [x] Expected newline after closing brace
  66 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  67 | ERROR   | [x] Line indented incorrectly; expected -10 spaces, found 20
  68 | ERROR   | [x] Line indented incorrectly; expected -10 spaces, found 20
  68 | ERROR   | [x] Expected 1 space after closing parenthesis; found 0
  69 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  70 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  71 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  72 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  73 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  74 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  75 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  75 | ERROR   | [x] Concat operator must be surrounded by a single space
  75 | ERROR   | [x] Concat operator must be surrounded by a single space
  75 | ERROR   | [x] Concat operator must be surrounded by a single space
  75 | ERROR   | [x] Concat operator must be surrounded by a single space
  75 | ERROR   | [x] Concat operator must be surrounded by a single space
  76 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  76 | ERROR   | [x] Concat operator must be surrounded by a single space
  76 | ERROR   | [x] Concat operator must be surrounded by a single space
  76 | ERROR   | [x] Concat operator must be surrounded by a single space
  76 | ERROR   | [x] Concat operator must be surrounded by a single space
  76 | ERROR   | [x] Concat operator must be surrounded by a single space
  77 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  77 | ERROR   | [x] Concat operator must be surrounded by a single space
  77 | ERROR   | [x] Concat operator must be surrounded by a single space
  77 | ERROR   | [x] Concat operator must be surrounded by a single space
  77 | ERROR   | [x] Concat operator must be surrounded by a single space
  78 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  79 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  79 | ERROR   | [x] Concat operator must be surrounded by a single space
  79 | ERROR   | [x] Concat operator must be surrounded by a single space
  79 | ERROR   | [x] Concat operator must be surrounded by a single space
  79 | ERROR   | [x] Concat operator must be surrounded by a single space
  80 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  81 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  81 | ERROR   | [x] Concat operator must be surrounded by a single space
  81 | ERROR   | [x] Concat operator must be surrounded by a single space
  81 | ERROR   | [x] Concat operator must be surrounded by a single space
  81 | ERROR   | [x] Concat operator must be surrounded by a single space
  81 | ERROR   | [x] Concat operator must be surrounded by a single space
  81 | ERROR   | [x] Concat operator must be surrounded by a single space
  82 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  83 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  83 | ERROR   | [x] Concat operator must be surrounded by a single space
  83 | ERROR   | [x] Concat operator must be surrounded by a single space
  84 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  85 | ERROR   | [x] Line indented incorrectly; expected -10 spaces, found 20
  86 | ERROR   | [x] Line indented incorrectly; expected -10 spaces, found 20
  86 | ERROR   | [x] Concat operator must be surrounded by a single space
  86 | ERROR   | [x] Concat operator must be surrounded by a single space
  87 | ERROR   | [x] Line indented incorrectly; expected -10 spaces, found 20
  88 | ERROR   | [x] Line indented incorrectly; expected -10 spaces, found 20
  89 | ERROR   | [x] Line indented incorrectly; expected -10 spaces, found 20
  91 | ERROR   | [x] Line indented incorrectly; expected -10 spaces, found 20
  91 | ERROR   | [x] Expected 1 space after FOR keyword; 0 found
  91 | ERROR   | [x] Expected 1 space after first semicolon of FOR loop; 0 found
  91 | ERROR   | [x] Expected 1 space before "<"; 0 found
  91 | ERROR   | [x] Expected 1 space after "<"; 0 found
  91 | ERROR   | [x] Expected 1 space after second semicolon of FOR loop; 0 found
  91 | ERROR   | [x] Expected 1 space after closing parenthesis; found 0
  92 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  93 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  94 | ERROR   | [x] Line indented incorrectly; expected -8 spaces, found 24
  95 | ERROR   | [x] Line indented incorrectly; expected -10 spaces, found 20
  96 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 16
  96 | ERROR   | [x] Expected newline after closing brace
  97 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 20
  98 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 16
  99 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
  99 | ERROR   | [x] Expected newline after closing brace
 100 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 16
 101 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 16
 102 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
 103 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 103 | ERROR   | [x] Expected newline after closing brace
 104 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
 105 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 105 | ERROR   | [x] Expected newline after closing brace
 106 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
 106 | ERROR   | [x] Concat operator must be surrounded by a single space
 106 | ERROR   | [x] Concat operator must be surrounded by a single space
 107 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 108 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 108 | ERROR   | [x] Expected 1 blank line after function; 0 found
 109 | ERROR   | [x] The closing brace for the class must have an empty line before it
 109 | ERROR   | [ ] Closing class brace must be on a line by itself
 109 | ERROR   | [x] Whitespace found at end of line
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 157 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------

Time: 9.98 secs; Memory: 10MB

Steps to reproduce

Run following command

 phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml dl_file/
๐Ÿ“Œ Task
Status

Needs work

Version

8.0

Component

Code

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

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia jay jangid Jaipur

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

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia jay jangid Jaipur

    I am working on it.

    Thank you.

  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia jay jangid Jaipur

    Created MR and solve all errors & warnings.
    Please review.

    Thank you.

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia amietpatial

    applied #5 MR and tested on drupal 10, errors are gone but still able to see one warning.
    Please see attached screenshot.

  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    The issue summary should always describe what the issue is trying to fix and, in the case, of coding standards issues, show which command has been used, which arguments have been used, and which report that command shown.

  • Assigned to nitin_lama
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India

    Fixed remaining phpcs issue. Please review.

  • Issue was unassigned.
  • Status changed to Needs review 12 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia zkhan.aamir

    Issue summary updated

  • Status changed to Needs work 5 months ago
  • Hi @nitin_lama,

    Your changes in MR !5 was applied successfully, however there are still errors not yet fixed. Please see below:

    dl_file git:(8.0.x) curl https://git.drupalcode.org/project/dl_file/-/merge_requests/5.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 10563    0 10563    0     0  26830      0 --:--:-- --:--:-- --:--:-- 27365
    patching file src/Commands/DlFileCommands.php
    โžœ  dl_file git:(8.0.x) โœ— cd ..
    โžœ  contrib git:(master) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig dl_file
    
    FILE: ...al-orgissue-v9/web/modules/contrib/dl_file/src/Commands/DlFileCommands.php
    --------------------------------------------------------------------------------
    FOUND 5 ERRORS AFFECTING 3 LINES
    --------------------------------------------------------------------------------
      6 | ERROR | [x] Use statements should be sorted alphabetically. The first
        |       |     wrong one is Drupal\Core\Database\Connection.
     48 | ERROR | [x] The first parameter of a multi-line function declaration must
        |       |     be on the line after the opening bracket
     49 | ERROR | [x] Multi-line function declaration not indented correctly;
        |       |     expected 4 spaces but found 2
     49 | ERROR | [x] Multi-line function declarations must have a trailing comma
        |       |     after the last parameter
     49 | ERROR | [x] The closing parenthesis of a multi-line function declaration
        |       |     must be on a new line
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    Time: 147ms; Memory: 10MB

    Kindly check

    Thanks,
    Jake

Production build 0.71.5 2024