Fix the issues reported by phpcs

Created on 4 July 2023, 12 months ago
Updated 26 February 2024, 4 months ago

Problem/Motivation

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

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 8 months 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 โ†’ (Open) created by chetan 11
  • Status changed to Needs review 8 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia chetan 11
  • Status changed to Needs work 8 months 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 4 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Prem Suthar gujrat

    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 .

Production build 0.69.0 2024