Fix the issues reported by phpcs

Created on 4 July 2023, almost 2 years ago

Problem/Motivation

FILE: ...ar/www/html/vb/d_cont/combined_image_style/src/Routing/RouteSubscriber.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
8 | ERROR | [x] Missing class doc comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ..._cont/combined_image_style/src/Controller/ImageStyleDownloadController.php
--------------------------------------------------------------------------------
FOUND 8 ERRORS AFFECTING 6 LINES
--------------------------------------------------------------------------------
10 | ERROR | [x] Missing class doc comment
12 | ERROR | [ ] Missing short description in doc comment
13 | ERROR | [ ] Missing parameter comment
14 | ERROR | [ ] Missing parameter comment
14 | ERROR | [ ] Missing parameter type
15 | ERROR | [ ] Missing parameter comment
15 | ERROR | [ ] Missing parameter type
17 | ERROR | [ ] Description for the @return value is missing
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/combined_image_style/src/Entity/ImageStyle.php
----------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------------
7 | ERROR | [x] Missing class doc comment
9 | ERROR | [x] Missing function doc comment
----------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------

FILE: .../www/html/vb/d_cont/combined_image_style/src/Entity/CombinedImageStyle.php
--------------------------------------------------------------------------------
FOUND 45 ERRORS AND 1 WARNING AFFECTING 45 LINES
--------------------------------------------------------------------------------
5 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be
| | referenced with use statements
15 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be
| | referenced with use statements
18 | ERROR | [x] Missing class doc comment
22 | ERROR | [ ] Missing short description in doc comment
27 | ERROR | [ ] Missing short description in doc comment
32 | ERROR | [ ] Missing short description in doc comment
33 | ERROR | [ ] Missing parameter comment
34 | ERROR | [ ] Missing parameter comment
36 | WARNING | [ ] Possible useless method overriding detected
40 | ERROR | [ ] Missing short description in doc comment
41 | ERROR | [ ] Missing parameter comment
43 | ERROR | [ ] Description for the @return value is missing
53 | ERROR | [ ] Missing short description in doc comment
54 | ERROR | [ ] Missing parameter comment
56 | ERROR | [ ] Description for the @return value is missing
78 | ERROR | [ ] Missing short description in doc comment
79 | ERROR | [ ] Description for the @return value is missing
87 | ERROR | [ ] Missing short description in doc comment
88 | ERROR | [ ] Description for the @return value is missing
94 | ERROR | [ ] Missing short description in doc comment
95 | ERROR | [ ] Missing parameter comment
104 | ERROR | [ ] Missing short description in doc comment
105 | ERROR | [ ] Description for the @return value is missing
111 | ERROR | [ ] Missing short description in doc comment
112 | ERROR | [ ] Missing parameter comment
123 | ERROR | [ ] Missing short description in doc comment
124 | ERROR | [ ] Missing parameter comment
124 | ERROR | [ ] Missing parameter type
133 | ERROR | [ ] Missing short description in doc comment
134 | ERROR | [ ] Description for the @return value is missing
140 | ERROR | [ ] Missing short description in doc comment
141 | ERROR | [ ] Description for the @return value is missing
179 | ERROR | [ ] Missing short description in doc comment
180 | ERROR | [ ] Missing parameter comment
182 | ERROR | [ ] Description for the @return value is missing
206 | ERROR | [ ] Missing short description in doc comment
207 | ERROR | [ ] Description for the @return value is missing
213 | ERROR | [ ] Missing short description in doc comment
214 | ERROR | [ ] Description for the @return value is missing
220 | ERROR | [ ] Missing short description in doc comment
221 | ERROR | [ ] Missing parameter comment
223 | ERROR | [ ] Description for the @return value is missing
236 | ERROR | [x] Missing function doc comment
281 | ERROR | [ ] The array declaration extends to column 147 (the limit is
| | 80). The array content should be split up over multiple
| | lines
324 | ERROR | [ ] Missing short description in doc comment
325 | ERROR | [ ] Description for the @return value is missing
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...d_image_style/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php
--------------------------------------------------------------------------------
FOUND 13 ERRORS AFFECTING 13 LINES
--------------------------------------------------------------------------------
36 | ERROR | [ ] Missing member variable doc comment
37 | ERROR | [ ] Missing member variable doc comment
39 | ERROR | [x] Missing function doc comment
46 | ERROR | [x] Missing function doc comment
60 | ERROR | [x] Missing function doc comment
68 | ERROR | [x] Missing function doc comment
154 | ERROR | [x] Missing function doc comment
160 | ERROR | [x] Missing function doc comment
176 | ERROR | [x] Missing function doc comment
236 | ERROR | [x] Missing function doc comment
240 | ERROR | [x] Missing function doc comment
243 | ERROR | [ ] The array declaration extends to column 97 (the limit is
| | 80). The array content should be split up over multiple
| | lines
244 | ERROR | [ ] The array declaration extends to column 102 (the limit is
| | 80). The array content should be split up over multiple
| | lines
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/combined_image_style/combined_image_style.module
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
20 | ERROR | [x] Data types in @var tags need to be fully namespaced
35 | WARNING | [x] A comma should follow the last multiline array item. Found:
| | ]
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 158ms; Memory: 12MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig combined_image_style/

Remaining tasks

Patch review

๐Ÿ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia urvashi_vora Madhya Pradesh, India

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 @urvashi_vora
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia ashutosh ahirwal India

    Unable to apply provided patch.

    Throwing error

    git apply -v coding-standard-fixes_6.patch
    Checking patch combined_image_style.module...
    error: while searching for:
    * Implements hook_ENTITY_TYPE_update().
    */
    function combined_image_style_image_style_update(ImageStyleInterface $entity): void {
    /** @var CombinedImageStyle $combinedImageStyle */
    foreach (CombinedImageStyle::loadCombinedBySingle($entity) as $combinedImageStyle) {
    $combinedImageStyle->flush();
    }

    error: patch failed: combined_image_style.module:17
    error: combined_image_style.module: patch does not apply
    Checking patch src/Controller/ImageStyleDownloadController.php...
    Checking patch src/Entity/CombinedImageStyle.php...
    error: while searching for:
    }

    /**
    * @return int
    */
    public function getWidth(): int {
    return $this->getDimensions($this->sourceUri)['width'] ?? 0;
    }

    /**
    * @return int
    */
    public function getHeight(): int {
    return $this->getDimensions($this->sourceUri)['height'] ?? 0;
    }

    /**
    * @param bool $create
    *
    * @return string
    */
    public function buildCombinedUri(bool $create = FALSE): string {
    $derivativeUri = $this->buildUri($this->sourceUri);

    error: patch failed: src/Entity/CombinedImageStyle.php:204
    error: src/Entity/CombinedImageStyle.php: patch does not apply
    Checking patch src/Entity/ImageStyle.php...
    error: while searching for:

    use Drupal\image\Entity\ImageStyle as ImageStyleBase;

    class ImageStyle extends ImageStyleBase {

    public function flush($path = NULL) {
    foreach (CombinedImageStyle::loadCombinedBySingle($this) as $combinedImageStyle) {
    $combinedImageStyle->flush($path);

    error: patch failed: src/Entity/ImageStyle.php:4
    error: src/Entity/ImageStyle.php: patch does not apply
    Checking patch src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php...
    Checking patch src/Routing/RouteSubscriber.php...

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia chetan 11

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

  • Merge request !1issue fixed โ†’ (Closed) created by chetan 11
  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines clarkssquared

    Hi chetan 11,

    I applied the updated MR !1 but I can still see more PHPCS issues that needs to be resolve, please look at the snippet of the errors

    โžœ  combined_image_style git:(1.0.x) curl https://git.drupalcode.org/project/combined_image_style/-/merge_requests/1.diff | git apply -v
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 17193    0 17193    0     0  35191      0 --:--:-- --:--:-- --:--:-- 35670
    Checking patch combined_image_style.module...
    Checking patch src/Controller/ImageStyleDownloadController.php...
    Checking patch src/Entity/CombinedImageStyle.php...
    Checking patch src/Entity/ImageStyle.php...
    Checking patch src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php...
    Checking patch src/Routing/RouteSubscriber.php...
    Applied patch combined_image_style.module cleanly.
    Applied patch src/Controller/ImageStyleDownloadController.php cleanly.
    Applied patch src/Entity/CombinedImageStyle.php cleanly.
    Applied patch src/Entity/ImageStyle.php cleanly.
    Applied patch src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php cleanly.
    Applied patch src/Routing/RouteSubscriber.php cleanly.
    โžœ  combined_image_style git:(1.0.x) โœ— ..
    โžœ  contrib git:(master) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml combined_image_style
    
    FILE: ...web/modules/contrib/combined_image_style/src/Entity/CombinedImageStyle.php
    --------------------------------------------------------------------------------
    FOUND 34 ERRORS AND 1 WARNING AFFECTING 34 LINES
    --------------------------------------------------------------------------------
      47 | WARNING | Possible useless method overriding detected
      51 | ERROR   | Missing short description in doc comment
      52 | ERROR   | Missing parameter comment
      54 | ERROR   | Description for the @return value is missing
      64 | ERROR   | Missing short description in doc comment
      65 | ERROR   | Missing parameter comment
      67 | ERROR   | Description for the @return value is missing
      89 | ERROR   | Missing short description in doc comment
      90 | ERROR   | Description for the @return value is missing
      98 | ERROR   | Missing short description in doc comment
      99 | ERROR   | Description for the @return value is missing
     105 | ERROR   | Missing short description in doc comment
     106 | ERROR   | Missing parameter comment
     115 | ERROR   | Missing short description in doc comment
     116 | ERROR   | Description for the @return value is missing
     122 | ERROR   | Missing short description in doc comment
     123 | ERROR   | Missing parameter comment
     134 | ERROR   | Missing short description in doc comment
     135 | ERROR   | Missing parameter comment
     135 | ERROR   | Missing parameter type
     144 | ERROR   | Missing short description in doc comment
     145 | ERROR   | Description for the @return value is missing
     151 | ERROR   | Missing short description in doc comment
     152 | ERROR   | Description for the @return value is missing
     190 | ERROR   | Missing short description in doc comment
     191 | ERROR   | Missing parameter comment
     193 | ERROR   | Description for the @return value is missing
     228 | ERROR   | Missing short description in doc comment
     229 | ERROR   | Description for the @return value is missing
     235 | ERROR   | Missing short description in doc comment
     236 | ERROR   | Description for the @return value is missing
     242 | ERROR   | Doc comment is empty
     291 | ERROR   | The array declaration extends to column 147 (the limit is 80).
         |         | The array content should be split up over multiple lines
     352 | ERROR   | Missing short description in doc comment
     353 | ERROR   | Description for the @return value is missing
    --------------------------------------------------------------------------------
    
    
    FILE: ...d_image_style/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     222 | ERROR | Doc comment short description must be on a single line, further
         |       | text should be a separate paragraph
    --------------------------------------------------------------------------------
    
    
    FILE: ...ntrib/combined_image_style/src/Controller/ImageStyleDownloadController.php
    --------------------------------------------------------------------------------
    FOUND 8 ERRORS AFFECTING 6 LINES
    --------------------------------------------------------------------------------
     10 | ERROR | Doc comment is empty
     15 | ERROR | Missing short description in doc comment
     16 | ERROR | Missing parameter comment
     17 | ERROR | Missing parameter comment
     17 | ERROR | Missing parameter type
     18 | ERROR | Missing parameter comment
     18 | ERROR | Missing parameter type
     20 | ERROR | Description for the @return value is missing
    --------------------------------------------------------------------------------
    
    Time: 399ms; Memory: 12MB
    

    Thanks

  • First commit to issue fork.
  • bindu r โ†’ made their first commit to this issueโ€™s fork.

  • First commit to issue fork.
  • Hi,
    Reviewed MR !1 as of #9, could still see some errors and warning.

    FILE: C:\combined_image_style\combined_image_style.module
    ----------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------
     1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
    ----------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------
    
    
    FILE: C:\combined_image_style\src\Controller\ImageStyleDownloadController.php
    ------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------
     1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
    ------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------
    
    
    FILE: C:\combined_image_style\src\Entity\CombinedImageStyle.php
    -------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    -------------------------------------------------------------------------------------
      1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
     47 | WARNING | [ ] Possible useless method overriding detected
    -------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------
    
    
    FILE: C:\combined_image_style\src\Entity\ImageStyle.php
    ----------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------
     1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
    ----------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------
    
    
    FILE: C:\combined_image_style\src\Plugin\Field\FieldFormatter\ResponsiveImageFormatter.php
    -------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------
     1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
    -------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------
    
    
    FILE: C:\combined_image_style\src\Routing\RouteSubscriber.php
    ----------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------
     1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
    ----------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------
    
    Time: 2.53 secs; Memory: 12MB
    
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia zkhan.aamir

    Issue summary updated.

  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan

    did not reproduce the error of #10 i got just one warning

    FILE: /home/prem/Documents/drupal11/modules/custom/combined_image_style-3372208/src/Entity/CombinedImageStyle.php
    -----------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------
     47 | WARNING | Possible useless method overriding detected
    -----------------------------------------------------------------------------------------------------------------
    
    Time: 181ms; Memory: 12MB
    

    this warning of using __constructor without calling a any services if we remove it then it will show the error so we can skip this warning .

  • First commit to issue fork.
  • Merge request !5Resolve #3372208 "Phpcs" โ†’ (Closed) created by svendecabooter
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium svendecabooter Gent

    Logic has evolved too much to fix the MR in this issue.
    Closing this one in favor of ๐Ÿ“Œ Add Gitlab CI integration + fix coding standards issues Active , while giving credit to contributors in this issue.

Production build 0.71.5 2024