Fix the issues reported by phpcs

Created on 17 August 2022, over 2 years ago
Updated 31 May 2024, 6 months ago

Fix the issues reported by phpcs.

Steps to reproduce:
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig .

FILE: /home/drupal/myproject/thumbor_effects_crop/src/Plugin/Field/FieldWidget/ThumborCropImageWidget.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 5 | WARNING | [x] Unused use statement
--------------------------------------------------------------------------------

FILE: /home/drupal/myproject/thumbor_effects_crop/src/ThumborCropManager.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------
 52 | ERROR   | The array declaration extends to column 85 (the limit is 80). The array content should be split up over multiple lines
 62 | ERROR   | The array declaration extends to column 109 (the limit is 80). The array content should be split up over multiple lines
 93 | WARNING | Unused variable $key.
--------------------------------------------------------------------------------

FILE: /home/drupal/myproject/thumbor_effects_crop/thumbor_effects_crop.module
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 29 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
 40 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
 53 | ERROR   | [x] Expected 1 newline at end of file; 2 found
--------------------------------------------------------------------------------
๐Ÿ“Œ Task
Status

RTBC

Version

1.0

Component

Documentation

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia Dharti Patel

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.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

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

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    -    foreach ($files_with_crop as ['crop_settings' => $crop_settings, 'file' => $file]) {
    +    foreach ($files_with_crop as [
    +      'crop_settings' => $crop_settings,
    +      'file' => $file,
    +    ]
    +      ) {

    There are lines that do not need to be truncated to 80 characters. The coding standards describe exactly which are the exceptions. Splitting that code does not make it more readable.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Mahima_Mathur23

    Reviewed the patch to be working as expected.
    And can see that the issue summary has added command used to replicate the report.

  • Status changed to RTBC over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Anmol_Specbee

    The patch seemed to be working as expected, moving it to RTBC.

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    -    foreach ($files_with_crop as ['crop_settings' => $crop_settings, 'file' => $file]) {
    +    foreach ($files_with_crop as [
    +      'crop_settings' => $crop_settings,
    +      'file' => $file,
    +    ]) {
    -    foreach ($this->getFilesWithCropSettings($entity) as ['crop_settings' => $crop_settings, 'file' => $file]) {
    +    foreach ($this->getFilesWithCropSettings($entity) as [
    +      'crop_settings' => $crop_settings,
    +      'file' => $file,
    +    ]) {

    See my previous comment: As per coding standards, control structure conditions may be written on a single line, if they are simpler to read and understand.

    Control structure conditions may exceed 80 characters, if they are simple to read and understand

    The existing code is simpler to understand.

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

    Addressed #18. Updated patch.

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India
  • First commit to issue fork.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Yashaswi18

    Remaining issues:

    FILE: /home/yashaswi/contribs/thumbor_effects_crop/src/ThumborCropManager.php
    ------------------------------------------------------------------------------------------------------------------------FOUND 2 ERRORS AFFECTING 2 LINES
    ------------------------------------------------------------------------------------------------------------------------ 52 | ERROR | The array declaration extends to column 85 (the limit is 80). The array content should be split up over
        |       | multiple lines
     62 | ERROR | The array declaration extends to column 109 (the limit is 80). The array content should be split up over
        |       | multiple lines
    ------------------------------------------------------------------------------------------------------------------------

    Command used :
    phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml thumbor_effects_crop/

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dev16.addweb

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

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dev16.addweb

    Resolved all issues that phpcs has reported. Please review since MR was also raised for the same.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    apaderno โ†’ changed the visibility of the branch 3304209-phpcs-coding-standard to hidden.

  • Pipeline finished with Success
    6 months ago
    Total: 180s
    #187431
  • Status changed to RTBC 6 months ago
Production build 0.71.5 2024