Fix the issues reported by phpcs

Created on 24 March 2023, over 1 year ago
Updated 30 March 2023, about 1 year ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/ds_chains/tests/src/Functional/ChainsUITest.php
-----------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------
23 | ERROR | Missing member variable doc comment
-----------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/ds_chains/tests/src/Kernel/ChainedFieldBuildTest.php
---------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------------------------
20 | ERROR | The array declaration extends to column 83 (the limit is 80). The array content should be split up over multiple lines
58 | WARNING | Unused variable $user_with_no_value.
---------------------------------------------------------------------------------------------------------------------------------------

Time: 4.06 secs; Memory: 6MB

Steps to reproduce

Run following command

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/ds_chains/

Proposed resolution

Above error/warnings need to be fixed.

📌 Task
Status

Needs work

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

Comments & Activities

  • 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 errors/warnings has been fixed.

  • First commit to issue fork.
  • @dineshkumarbollu opened merge request.
  • Status changed to RTBC over 1 year ago
  • 🇮🇳India dineshkumarbollu

    Hi

    The patch is applied zero phpcs errors in my local.
    Then I created MR for this patch.

    Thanks.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Status changed to Needs work about 1 year ago
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    Removing credit for the MR when there was already a patch.

    @samit.310@gmail.com, whilst I appreciate coding standards patches, my policy is not to give credit to contributors who already have credit for coding standards patches. Coding standards patches are great for folks finding their feet with the mechanics of contribution, but more experienced developers can help in other ways. Please refer to tip 2 on https://www.previousnext.com.au/blog/5-simple-tips-increase-your-drupal-... for more information. As I can see from your profile that you have a number of phpcs credits already, I've decided to remove your credit in this instance.

    +++ b/tests/src/Kernel/ChainedFieldBuildTest.php
    @@ -55,7 +60,7 @@ class ChainedFieldBuildTest extends EntityKernelTestBase {
    -    $user_with_no_value = $this->createUser();
    +    $this->createUser();
    

    Can we replace this with a comment - e.g.

    'Create a user with no value for test_field' to explain why we need it?

Production build 0.69.0 2024