Fix the issues reported by phpcs

Created on 27 April 2023, over 1 year ago
Updated 11 June 2024, 6 months ago
šŸ“Œ Task
Status

RTBC

Version

2.0

Component

Code

Created by

šŸ‡®šŸ‡³India Asheesh kumar Pal New Delhi

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 @Asheesh kumar Pal
  • šŸ‡®šŸ‡³India Asheesh kumar Pal New Delhi

    FILE: /var/www/html/drupal_cms/newtheme/web/modules/contrib/schemadata/README.txt
    ---------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------
    33 | ERROR | [x] Expected 1 newline at end of file; 0 found
    ---------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------

    FILE: /var/www/html/drupal_cms/newtheme/web/modules/contrib/schemadata/schemadata.info.yml
    ------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------
    7 | ERROR | [x] Expected 1 newline at end of file; 0 found
    ------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------

    FILE: /var/www/html/drupal_cms/newtheme/web/modules/contrib/schemadata/src/Controller/SchemadataController.php
    ----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 31 ERRORS AND 12 WARNINGS AFFECTING 38 LINES
    ----------------------------------------------------------------------------------------------------------------------------------------------
    9 | ERROR | [x] There must be one blank line after the last USE statement; 0 found;
    14 | ERROR | [ ] Missing short description in doc comment
    15 | ERROR | [x] Whitespace found at end of line
    19 | ERROR | [ ] Public method name "SchemadataController::show_all_tables" is not in lowerCamel format
    19 | ERROR | [x] Expected 1 blank line before function; 0 found
    21 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    23 | ERROR | [x] Short array syntax must be used to define arrays
    24 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
    24 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
    26 | ERROR | [x] Short array syntax must be used to define arrays
    27 | ERROR | [x] Short array syntax must be used to define arrays
    28 | ERROR | [x] Short array syntax must be used to define arrays
    33 | ERROR | [x] Short array syntax must be used to define arrays
    34 | ERROR | [x] Array indentation error, expected 8 spaces but found 14
    35 | ERROR | [x] Array closing indentation error, expected 6 spaces but found 18
    38 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
    38 | WARNING | [ ] Only string literals should be passed to t() where possible
    40 | ERROR | [x] Short array syntax must be used to define arrays
    49 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
    55 | ERROR | [x] Whitespace found at end of line
    56 | ERROR | [ ] Missing short description in doc comment
    57 | ERROR | [x] Whitespace found at end of line
    60 | ERROR | [x] Whitespace found at end of line
    63 | ERROR | [x] Data types in @throws tags need to be fully namespaced
    65 | ERROR | [ ] Public method name "SchemadataController::explain_table" is not in lowerCamel format
    67 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    68 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
    71 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    77 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    78 | ERROR | [x] Short array syntax must be used to define arrays
    81 | ERROR | [x] Short array syntax must be used to define arrays
    81 | ERROR | [ ] The array declaration extends to column 107 (the limit is 80). The array content should be split up over multiple lines
    81 | ERROR | [x] Short array syntax must be used to define arrays
    83 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    89 | ERROR | [x] Short array syntax must be used to define arrays
    91 | ERROR | [x] Short array syntax must be used to define arrays
    98 | ERROR | [x] Short array syntax must be used to define arrays
    102 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
    105 | ERROR | [x] Short array syntax must be used to define arrays
    106 | WARNING | [x] A comma should follow the last multiline array item. Found: 'pager'
    110 | ERROR | [x] Expected newline after closing brace
    113 | ERROR | [x] Expected 1 blank line after function; 0 found
    114 | ERROR | [x] The closing brace for the class must have an empty line before it
    ----------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 27 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------------

    FILE: /var/www/html/drupal_cms/newtheme/web/modules/contrib/schemadata/schemadata.routing.yml
    ---------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------
    13 | ERROR | [x] Expected 1 newline at end of file; 0 found
    ---------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------

    FILE: /var/www/html/drupal_cms/newtheme/web/modules/contrib/schemadata/schemadata.links.menu.yml
    ------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------
    5 | ERROR | [x] Expected 1 newline at end of file; 0 found
    ------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------

    FILE: /var/www/html/drupal_cms/newtheme/web/modules/contrib/schemadata/schemadata.module
    ----------------------------------------------------------------------------------------
    FOUND 6 ERRORS AND 3 WARNINGS AFFECTING 6 LINES
    ----------------------------------------------------------------------------------------
    1 | ERROR | [x] Missing file doc comment
    8 | WARNING | [ ] Hook implementations should not duplicate @param documentation
    8 | ERROR | [ ] Missing parameter name
    10 | WARNING | [ ] Hook implementations should not duplicate @param documentation
    10 | ERROR | [ ] Missing parameter name
    20 | ERROR | [x] Case breaking statements must be followed by a single blank line
    21 | WARNING | [ ] Code after the RETURN statement on line 20 cannot be executed
    21 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
    23 | ERROR | [x] Expected 1 newline at end of file; 0 found
    ----------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY

  • šŸ‡®šŸ‡³India Asheesh kumar Pal New Delhi

    I have applied the patch for the above issue, please review it

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Assigned to Kaustab_Roy
  • šŸ‡®šŸ‡³India Kaustab_Roy

    i will review it

  • šŸ‡®šŸ‡³India Kaustab_Roy

    Check patch#2, it didn't apply and throwing path errors.

    Added a new patch with the fixes.
    before & after patch applied results attached.

    Kindly review.

  • Issue was unassigned.
  • šŸ‡®šŸ‡³India Kaustab_Roy

    Added dependency injection as per standard, Fixed the error on request object.
    Kindly review.

  • 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 has been used, which arguments have been used, and which report that command shown.

  • šŸ‡ØšŸ‡¦Canada imustakim Canada

    Issue summary updated.

  • Status changed to Needs review over 1 year ago
  • šŸ‡ØšŸ‡¦Canada imustakim Canada
  • First commit to issue fork.
  • Status changed to Needs work over 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
    +  /**
    +   * Database connection.
    +   *
    +   * @var \Drupal\Core\Database\Connection
    +   */
    +  protected $connection;
    +
    +  /**
    +   * Request object.
    +   *
    +   * @var \Symfony\Component\HttpFoundation\Request
    +   */
    +  protected $request;

    The descriptions are each missing a definite article.

    The patch is not even complete, since the report shows warning/errors for six files, but the patch changes just a file.

    +  /**
    +   * {@inheritdoc}
    +   */
    +  public function __construct(Connection $connection, Request $request) {

    {@inheritdoc} is not used for constructors.

  • @nitin_lama opened merge request.
  • Assigned to nitin_lama
  • @nitin_lama opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India nitin_lama India

    Committed changes on MR3. Please review.

  • šŸ‡®šŸ‡³India nitin_lama India

    Re-rolled patch.

  • šŸ‡®šŸ‡³India nitin_lama India

    Re-rolled patch. Hiding the #18 patch (incorrect naming of file.)

  • Status changed to RTBC over 1 year ago
  • šŸ‡®šŸ‡³India Anmol_Specbee

    The patch#18 seems to working fine. Moving to RTBC.

  • Status changed to Needs work over 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
     core: 8.x
    -core_version_requirement: ^8 || ^9

    There is no need to remove that line.

    +/**
    + * @file
    + * This is the module to display database schema in a page.
    + */
    +

    The correct description is Hook implementations for the Schemadata module.

    +   *
        * @return string
        *   Table theme is returns

    Since that documentation comment is edited, the return value description must be changed too: Table theme is returns is not grammatically correct nor does it make sense.

  • Assigned to nitin_lama
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India nitin_lama India

    For #21.1, line is not being removed.

  • Hi @nitin_lama,

    Latest changes in MR3 was applied successfully and fixed most errors but few errors remaining. Please see below:

     schemadata git:(2.0.x) curl https://git.drupalcode.org/project/schemadata/-/merge_requests/3.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  9683    0  9683    0     0  24998      0 --:--:-- --:--:-- --:--:-- 25821
    patching file README.txt
    patching file schemadata.info.yml
    patching file schemadata.links.menu.yml
    patching file schemadata.module
    patching file schemadata.routing.yml
    patching file src/Controller/SchemadataController.php
    āžœ  schemadata git:(2.0.x) āœ— cd ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig schemadata
    
    FILE: ...-v9/web/modules/contrib/schemadata/src/Controller/SchemadataController.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    --------------------------------------------------------------------------------
      7 | ERROR   | [x] Use statements should be sorted alphabetically. The first
        |         |     wrong one is Drupal\Core\Controller\ControllerBase.
     82 | WARNING | [ ] Only string literals should be passed to t() where possible
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    Time: 150ms; Memory: 10MB

    Kindly check.

    Thanks,
    Jake

  • Pipeline finished with Success
    7 months ago
    Total: 138s
    #193741
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Pipeline finished with Success
    7 months ago
    #193752
  • Status changed to RTBC 6 months ago
  • Hi @apaderno,

    Applied your changes in MR!4, all changes applied successfully and confirmed all warnings/errors fixed.

    schemadata git:(2.0.x) curl https://git.drupalcode.org/project/schemadata/-/merge_requests/4.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 11630    0 11630    0     0  16628      0 --:--:-- --:--:-- --:--:-- 16806
    patching file .gitlab-ci.yml
    patching file README.txt
    patching file schemadata.info.yml
    patching file schemadata.links.menu.yml
    patching file schemadata.module
    patching file schemadata.routing.yml
    patching file src/Controller/SchemadataController.php
    āžœ  schemadata git:(2.0.x) āœ— cd ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig schemadata
    zsh: command not found: phpcs
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig schemadata
    āžœ  contrib git:(master) āœ—

    Will now move this to RTBC.

    Thanks,
    Jake

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    apaderno ā†’ changed the visibility of the branch 2.0.x to hidden.

Production build 0.71.5 2024