Fix the issues reported by phpcs

Created on 19 August 2021, over 3 years ago
Updated 30 May 2024, 7 months ago

Problem/Motivation

FILE: /Users/specbee/Sites/Projects/url_redirect/url_redirect.install
--------------------------------------------------------------------------------------------------
FOUND 14 ERRORS AND 1 WARNING AFFECTING 13 LINES
--------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] Missing file doc comment
 42 | ERROR   | [x] Short array syntax must be used to define arrays
 43 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 44 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 45 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 46 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 47 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 47 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
 48 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 48 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
 49 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 50 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 51 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
 53 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
 57 | WARNING | [ ] Line exceeds 80 characters; contains 88 characters
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 14 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/url_redirect/tests/src/Functional/UrlRedirectNegateTest.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 21 ERRORS AND 1 WARNING AFFECTING 17 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
  82 | ERROR   | [x] Short array syntax must be used to define arrays
  83 | ERROR   | [x] Short array syntax must be used to define arrays
  95 | ERROR   | [x] Short array syntax must be used to define arrays
  95 | ERROR   | [ ] The array declaration extends to column 82 (the limit is 80). The array content should be split up over multiple lines
  96 | ERROR   | [x] Short array syntax must be used to define arrays
 103 | ERROR   | [x] Short array syntax must be used to define arrays
 103 | ERROR   | [ ] The array declaration extends to column 98 (the limit is 80). The array content should be split up over multiple lines
 104 | ERROR   | [x] Short array syntax must be used to define arrays
 104 | ERROR   | [ ] The array declaration extends to column 96 (the limit is 80). The array content should be split up over multiple lines
 111 | ERROR   | [x] Missing function doc comment
 127 | ERROR   | [x] Missing function doc comment
 147 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
 149 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
 151 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
 151 | ERROR   | [x] Parameter comment must end with a full stop
 153 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
 155 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
 155 | ERROR   | [ ] Parameter comment must start with a capital letter
 157 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
 159 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
 161 | ERROR   | [ ] Type hint "array" missing for $check_value
 175 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 16 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/url_redirect/url_redirect.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: /Users/specbee/Sites/Projects/url_redirect/README.txt
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 28 | WARNING | Line exceeds 80 characters; contains 87 characters
----------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/url_redirect/url_redirect.permissions.yml
-----------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------
 11 | ERROR | [x] Expected 1 newline at end of file; 0 found
-----------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/url_redirect/src/Form/UrlRedirectForm.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 36 ERRORS AND 19 WARNINGS AFFECTING 53 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
   9 | ERROR   | [x] There must be one blank line after the last USE statement; 2 found;
  28 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
  51 | ERROR   | [x] Short array syntax must be used to define arrays
  59 | ERROR   | [x] Short array syntax must be used to define arrays
  62 | ERROR   | [x] Short array syntax must be used to define arrays
  63 | ERROR   | [x] Short array syntax must be used to define arrays
  67 | ERROR   | [x] Short array syntax must be used to define arrays
  69 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  73 | ERROR   | [x] Short array syntax must be used to define arrays
  76 | ERROR   | [x] Short array syntax must be used to define arrays
  82 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  84 | ERROR   | [x] Short array syntax must be used to define arrays
  87 | ERROR   | [x] Short array syntax must be used to define arrays
  92 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  95 | ERROR   | [x] Short array syntax must be used to define arrays
  97 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  98 | ERROR   | [x] Short array syntax must be used to define arrays
  99 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 100 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 100 | WARNING | [x] A comma should follow the last multiline array item. Found: )
 105 | ERROR   | [x] Short array syntax must be used to define arrays
 107 | ERROR   | [x] Short array syntax must be used to define arrays
 108 | ERROR   | [x] Short array syntax must be used to define arrays
 109 | ERROR   | [x] Short array syntax must be used to define arrays
 114 | ERROR   | [x] Short array syntax must be used to define arrays
 116 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 122 | ERROR   | [x] Short array syntax must be used to define arrays
 124 | ERROR   | [x] Short array syntax must be used to define arrays
 125 | ERROR   | [x] Short array syntax must be used to define arrays
 126 | ERROR   | [x] Short array syntax must be used to define arrays
 132 | WARNING | [ ] User::loadMultiple calls should be avoided in classes, use dependency injection instead
 137 | ERROR   | [x] Short array syntax must be used to define arrays
 144 | ERROR   | [x] Short array syntax must be used to define arrays
 149 | ERROR   | [x] Short array syntax must be used to define arrays
 151 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 153 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 154 | ERROR   | [x] Short array syntax must be used to define arrays
 155 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 156 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 156 | WARNING | [x] A comma should follow the last multiline array item. Found: )
 160 | ERROR   | [x] Short array syntax must be used to define arrays
 162 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 163 | ERROR   | [x] Short array syntax must be used to define arrays
 164 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 165 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 182 | ERROR   | [x] Object operator not indented correctly; expected 6 spaces but found 8
 185 | ERROR   | [x] Short array syntax must be used to define arrays
 188 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 189 | ERROR   | [x] Short array syntax must be used to define arrays
 214 | ERROR   | [x] Short array syntax must be used to define arrays
 215 | ERROR   | [x] Array indentation error, expected 8 spaces but found 12
 219 | ERROR   | [x] Short array syntax must be used to define arrays
 220 | ERROR   | [x] Array indentation error, expected 8 spaces but found 12
 228 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
 233 | ERROR   | [x] Object operator not indented correctly; expected 6 spaces but found 8
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 38 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/url_redirect/src/Form/UrlRedirectDeleteForm.php
-----------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------
 18 | ERROR | [x] Short array syntax must be used to define arrays
 40 | ERROR | [x] Short array syntax must be used to define arrays
-----------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/url_redirect/src/Entity/UrlRedirect.php
---------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AFFECTING 10 LINES
---------------------------------------------------------------------------------------------------
  97 | ERROR | [x] Expected "bool" but found "boolean" for @var tag in member variable comment
 118 | ERROR | [ ] Public method name "UrlRedirect::get_path" is not in lowerCamel format
 125 | ERROR | [ ] Public method name "UrlRedirect::get_redirect_path" is not in lowerCamel format
 132 | ERROR | [ ] Public method name "UrlRedirect::get_checked_for" is not in lowerCamel format
 139 | ERROR | [ ] Public method name "UrlRedirect::get_roles" is not in lowerCamel format
 146 | ERROR | [ ] Public method name "UrlRedirect::get_users" is not in lowerCamel format
 153 | ERROR | [ ] Public method name "UrlRedirect::get_message" is not in lowerCamel format
 160 | ERROR | [ ] Public method name "UrlRedirect::get_status" is not in lowerCamel format
 167 | ERROR | [ ] Description for the @return value is missing
 169 | ERROR | [ ] Public method name "UrlRedirect::get_negate" is not in lowerCamel format
---------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/url_redirect/src/Controller/UrlRedirectListBuilder.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AND 4 WARNINGS AFFECTING 7 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
 13 | ERROR   | [ ] Missing member variable doc comment
 27 | ERROR   | [x] Expected 1 blank line after function; 2 found
 52 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 52 | ERROR   | [x] Expected 1 space after closing parenthesis; found 0
 53 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 55 | ERROR   | [x] Expected 1 space after ELSE keyword; 0 found
 56 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 60 | WARNING | [x] There must be no blank line following an inline comment
 60 | WARNING | [ ] There must be no blank line following an inline comment
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/url_redirect/src/UrlRedirectInterface.php
-----------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------
 11 | ERROR | [x] Whitespace found at end of line
-----------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/url_redirect/src/EventSubscriber/RedirectSubscriber.php
-------------------------------------------------------------------------------------------------------------------------------
FOUND 35 ERRORS AND 3 WARNINGS AFFECTING 28 LINES
-------------------------------------------------------------------------------------------------------------------------------
  20 | ERROR   | [x] Missing class doc comment
  64 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
  66 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
  68 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
  70 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
  72 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
  74 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
  76 | ERROR   | [x] Expected 1 blank line before function; 2 found
  89 | WARNING | [ ] Line exceeds 80 characters; contains 86 characters
  90 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
 101 | ERROR   | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
 103 | ERROR   | [ ] Missing parameter comment
 103 | ERROR   | [x] Data types in @param tags need to be fully namespaced
 115 | ERROR   | [ ] Missing parameter comment
 115 | ERROR   | [x] Data types in @param tags need to be fully namespaced
 124 | ERROR   | [ ] Missing parameter comment
 124 | ERROR   | [x] Data types in @param tags need to be fully namespaced
 137 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 149 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 149 | ERROR   | [x] Expected 1 space after closing parenthesis; found 0
 203 | ERROR   | [x] Short array syntax must be used to define arrays
 213 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
 214 | ERROR   | [x] Separate the @param and @return sections by a blank line.
 214 | ERROR   | [ ] Description for the @return value is missing
 219 | ERROR   | [x] Object operator not indented correctly; expected 6 spaces but found 8
 228 | ERROR   | [ ] Doc comment for parameter $path does not match actual variable name <undefined>
 229 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
 230 | ERROR   | [x] Separate the @param and @return sections by a blank line.
 230 | ERROR   | [ ] Description for the @return value is missing
 235 | ERROR   | [x] Object operator not indented correctly; expected 6 spaces but found 8
 244 | ERROR   | [ ] Missing parameter comment
 244 | ERROR   | [x] Expected "mixed" but found "type" for parameter type
 245 | ERROR   | [x] Separate the @param and @return sections by a blank line.
 245 | ERROR   | [x] Expected "mixed" but found "type" for function return type
 245 | ERROR   | [ ] Description for the @return value is missing
 247 | ERROR   | [ ] Public method name "RedirectSubscriber::url_redirect_is_external" is not in lowerCamel format
 248 | ERROR   | [x] Inline comments must start with a capital letter
 248 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
-------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 25 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/url_redirect/src/EventSubscriber/RedirectSettingsCacheTag.php
-------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------
 11 | WARNING | Line exceeds 80 characters; contains 84 characters
-------------------------------------------------------------------------------------------------

Time: 261ms; Memory: 12MB

Steps to reproduce

Run following command
phpcs --standard=“Drupal,DrupalPractice” --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css,js .

📌 Task
Status

RTBC

Version

3.0

Component

Code

Created by

🇧🇷Brazil Takuma Shimabukuro

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.

  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

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

  • 🇨🇦Canada imustakim Canada

    Issue summary updated.

  • 🇮🇳India jaykainthola

    Changing to latest target issue branch.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇮🇳India jaykainthola

    Attached patch for code review.

  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.0 & MySQL 5.7
    last update about 1 year ago
    Patch Failed to Apply
  • 🇮🇳India sonvir249 Pune

    sonvir249 changed the visibility of the branch 8.x-3.x to hidden.

  • Merge request !2Issue 3228984 by takuma-shimabukuro → (Open) created by jaykainthola
  • Status changed to Needs work 7 months ago
  • Hi @jaykainthola,

    I applied the MR !2, it applied successfully however one warning still persists.

    url_redirect git:(1ac9edc) curl https://git.drupalcode.org/project/url_redirect/-/merge_requests/2.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  8709    0  8709    0     0  21378      0 --:--:-- --:--:-- --:--:-- 22104
    patching file src/EventSubscriber/RedirectSubscriber.php
    patching file src/Form/UrlRedirectDeleteForm.php
    patching file src/Form/UrlRedirectForm.php
    patching file tests/src/Functional/UrlRedirectNegateTest.php
    patching file url_redirect.install
    patching file url_redirect.permissions.yml
    ➜  url_redirect git:(1ac9edc) ✗ cd ..
    ➜  contrib git:(main) ✗ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig url_redirect
    
    FILE: ...erns/Demo-site/drupal-orgissue/web/modules/contrib/url_redirect/README.txt
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     28 | WARNING | Line exceeds 80 characters; contains 87 characters
    --------------------------------------------------------------------------------
    
    Time: 714ms; Memory: 10MB

    Kindly check

    Thanks,
    Jake

  • 🇮🇳India dev16.addweb

    silvi.addweb made their first commit to this issue’s fork.

  • Status changed to Needs review 7 months ago
  • 🇮🇳India dev16.addweb

    I have fix issue reported in #24, Please review.

  • Status changed to RTBC 7 months ago
  • Hi @silvi.addweb,

    Applied your fix, no errors/warnings found.

    contrib git:(main) ✗ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig url_redirect
    ➜  contrib git:(main) ✗

    Moving this to RTBC

    Thanks,
    Jake

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    apaderno changed the visibility of the branch 3228984--i-found to hidden.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    apaderno changed the visibility of the branch 3228984-phpcs-fixes to hidden.

  • Pipeline finished with Failed
    7 months ago
    Total: 225s
    #185966
  • Pipeline finished with Failed
    7 months ago
    Total: 141s
    #186044
Production build 0.71.5 2024