Fix the issues reported by phpcs

Created on 3 March 2023, over 1 year ago
Updated 31 May 2024, 28 days ago
šŸ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India samit.310@gmail.com

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.

  • Issue created by @samit.310@gmail.com
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India samit.310@gmail.com

    Above error/warnings are fixed.

  • Status changed to Needs work over 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    The only tag for coding standard issues is Coding standards.

  • šŸ‡®šŸ‡³India kkalashnikov Ghaziabad, India

    Include all the changes which is in #5 in current patch.

  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
    +    // This is based on code in core node module NodeTypeForm.php.
    +    if ($this->moduleHandler->moduleExists('language')) {

    Spaces are not used as separator in file paths.

    There are other corrections to be done.

  • Status changed to Needs work over 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Status changed to Needs review about 1 year ago
  • Open on Drupal.org ā†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.6
    last update about 1 year ago
    Waiting for branch to pass
  • Status changed to Needs work about 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
    +/**
    + * Form controller for the usermanualtype entity edit forms.
    + */

    It does not seem usermanualtype is the entity type.

    -    //  This is based on code in core node module NodeTypeForm.php.
    -    if  ($this->moduleHandler->moduleExists('language')) {
    +    // This is based on code in core node module NodeTypeForm.php.
    This code is based on code found in the Drupal core NodeTypeForm.php file.
    -    return $this->generatePermissions(UserManualType::loadMultiple(), [$this, 'buildPermissions']);
    +    return $this->generatePermissions(UserManualType::loadMultiple(),
    +    [$this, 'buildPermissions']);

    I would leave the code as it is. If you want to split in multiple lines, the last line must be indented, and the last parenthesis put on its own line.

    -  $manual_entries = _user_manual_test_manual_entries(_user_manual_test_user_manual_types(), [1, 2, 3, 4]);
    +  $manual_entries = _user_manual_test_manual_entries(_user_manual_test_user_manual_types(),
    +   [1, 2, 3, 4]);

    I would rather leave the code as it is, since Line length and wrapping ā†’ , part of the Drupal coding standards, says:

    • Lines containing longer function names, function/class definitions, variable declarations, etc are allowed to exceed 80 characters.
    • Control structure conditions may exceed 80 characters, if they are simple to read and understand.

    (Emphasis is mine.)

      * @param string $label
    - *   label for user manual type.
    + *   Label for user manual type.

    I would check the name of the entity type.

    -  // If admin_toolbar is exists, then we will add dropdown menu by user manual topics.
    +  // If admin_toolbar is exists, then we will add dropdown
    +  // menu by user manual topics.

    Since that comment is edited, the verb needs to be fixed. It is exists, not is exists.

    -  // Set name field display
    +  // Set name field display.

    That is probably Set the field display name.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
    -    //  This is based on code in core node module NodeTypeForm.php.
    -    if  ($this->moduleHandler->moduleExists('language')) {
    +    // This is based on code in core node module NodeTypeForm.php.
    +    if ($this->moduleHandler->moduleExists('language')) {

    See my previous comment.

       /**
    -   * Verify that taxonomy terms appear in the toolbar
    +   * Verify that taxonomy terms appear in the toolbar.
        */

    The verb must be declined to the third person singular. That is true for all the method/function/class descriptions.

    - * @param string $block_type_id
    - *   Id of the block type.
    + * @param string $user_manual_type_id
    + *   Id of the user manual type.
      *
      * @throws \Drupal\Core\Entity\EntityStorageException
      */
     function user_manual_add_default_fields($user_manual_type_id) {

    The descriptions are each missing a definite article. The correct spelling of Id is ID.

    -  // Set name field display
    +  // Set name field display.
       $view_modes = \Drupal::service('entity_display.repository')->getViewModes('user_manual');

    Since that comment is changed, it should also be corrected. At least, a definite article is missing.

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

    Addressing #12 and fixing possible phpcs issues.

  • Open on Drupal.org ā†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.6
    last update 7 months ago
    Waiting for branch to pass
  • Open on Drupal.org ā†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.6
    last update 7 months ago
    Waiting for branch to pass
  • šŸ‡®šŸ‡³India nitin_lama

    Please review.
    Thanks.

  • Issue was unassigned.
  • Status changed to Needs review 7 months ago
  • Status changed to Needs work 29 days ago
  • Hi @nitin_lama,

    Applied patch #14 successfully, but it throws an error and a warning.

    user_manual git:(1.0.x) curl https://www.drupal.org/files/issues/2023-12-01/phpcs-fixes-3345706-14.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 14227  100 14227    0     0  20707      0 --:--:-- --:--:-- --:--:-- 21108
    patching file src/DocsListing.php
    patching file src/Entity/UserManual.php
    patching file src/Entity/UserManualType.php
    patching file src/Form/UserManualTypeEntityForm.php
    patching file src/UserManualAccessControlHandler.php
    patching file src/UserManualPermissions.php
    patching file tests/modules/user_manual_test/user_manual_test.install
    patching file tests/src/Functional/AccessTest.php
    patching file tests/src/Functional/ToolbarTest.php
    patching file user_manual.module
    āžœ  user_manual git:(1.0.x) āœ— cd ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig user_manual
    
    FILE: /Users/PrometInterns/Demo-site/drupal-orgissue/web/modules/contrib/user_manual/templates/user-manual.html.twig
    --------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------------
     55 | ERROR | [x] Expected 1 newline at end of file; 2 found
    --------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/PrometInterns/Demo-site/drupal-orgissue/web/modules/contrib/user_manual/src/Form/UserManualTypeEntityForm.php
    --------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------------------
     51 | WARNING | Line exceeds 80 characters; contains 81 characters
    --------------------------------------------------------------------------------------------------------------------------
    
    Time: 596ms; Memory: 12MB

    Kindly check.

    Thanks,
    Jake

  • Open on Drupal.org ā†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.6
    last update 28 days ago
    Waiting for branch to pass
  • Pipeline finished with Success
    28 days ago
    Total: 151s
    #187265
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Open on Drupal.org ā†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.6
    last update 28 days ago
    Waiting for branch to pass
  • Pipeline finished with Success
    28 days ago
    Total: 238s
    #187290
  • Open on Drupal.org ā†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.6
    last update 28 days ago
    Waiting for branch to pass
  • Status changed to Needs review 28 days ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Pipeline finished with Success
    28 days ago
    Total: 190s
    #187356
Production build 0.69.0 2024