Fix the issues reported by phpcs

Created on 8 February 2023, over 1 year ago
Updated 13 June 2024, 10 days ago
šŸ“Œ Task
Status

Needs work

Version

2.0

Component

Code

Created by

šŸ‡®šŸ‡³India arunkumark Coimbatore

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 @arunkumark
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India Adil_Siddiqui

    Patch created and fixed above Drupal coding standard issues.
    The phpcd command given below is used which give issues according to drupal standard:
    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml force_users_logout

  • First commit to issue fork.
  • šŸ‡®šŸ‡³India Nayana Ramakrishnan

    Verified the patch #2 and tested it on Drupal version 10.1.x and Force Users Logout 2.0.x. The patch applied cleanly and all the errors mentioned in the ticket are fixed after applying the patch.

  • šŸ‡®šŸ‡³India noorulshameera

    Patch #2 applied cleanly.
    However found one more issue while running
    vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml web/modules/contrib/force_users_logout

    FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/force_users_logout/force_users_logout.module
    ---------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------
    36 | ERROR | [x] Expected 1 newline at end of file; 0 found
    ---------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------

    so adding a patch which fixes issues including above one as well.

  • Status changed to RTBC over 1 year ago
  • šŸ‡®šŸ‡³India Akram Khan Cuttack, Odisha

    Checked patch #5 it applied successfully and it remove all PHPCS issue so move to RTBC

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

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • šŸ‡®šŸ‡³India Indra patil Bangalore
  • šŸ‡®šŸ‡³India Indra patil Bangalore
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
        * @param \Drupal\Core\Database\Connection $connection
        *   The database connection.
    +   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
    +   *   Entity type manager service.
    

    The article at the beginning of the description is missing, as it is missing on a similar description given in another line.

       /**
        * Constructs.
        *
        * @param \Drupal\Core\Database\Connection $connection
        *   The database connection.
    +   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
    +   *   Entity type manager service.
        */
    

    Since that comment is changed, the first line should be changed too, as constructors are not described as Constructs.

    -   * Constructs entity type manager service.
    +   * Drupal\Core\Session\AccountProxyInterface definition.
        *
    -   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
    -   *   The entity type manager.
    +   * @var \Drupal\Core\Session\AccountProxyInterface

    Parameters are not described with @var.

    +  /**
    +   * Class constructor.
    +   */
    +  public function __construct(EntityTypeManagerInterface $entity_type_manager, AccountProxyInterface $current_user, SessionManager $session_manager) {
         $this->entityTypeManager = $entity_type_manager;
    +    $this->currentUser = $current_user;
    +    $this->sessionManager = $session_manager;
       }
    

    A class constructor is not described in that way. The description for the parameter is also missing.

  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India imustakim Ahmedabad

    Updated patch.
    Please review.

  • Status changed to RTBC about 1 year ago
  • šŸ‡®šŸ‡³India TanujJain-TJ

    Tested patch #15 on drupal: 10.1.x, the patch applied successfully and removed all the errors reported by phpcs. RTBC

  • Status changed to Needs work about 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
    +  /**
    +  /**
    +   * Constructs the AutocompleteController object.
        *
        * @param \Drupal\Core\Database\Connection $connection
        *   The database connection.
    +   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
    +   *   The entity type manager.
        */

    The class namespace is missing.
    Since the constructor does not just constructs a single instance, the article used is wrong.

       /**
    -   * Constructs entity type manager service.
    +   * Drupal\Core\Session\AccountProxyInterface definition.
    +   *
    +   * @var \Drupal\Core\Session\AccountProxyInterface
    +   */
    +  protected $currentUser;

    Repeating the class name is not how a property is documented.

  • Status changed to Needs review about 1 year ago
  • šŸ‡®šŸ‡³India arpitk

    Hi Updated the patch #15 with the issues addresed in #17 Please review.

    Thanks!

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

    + * Constructs a new AutocompleteController object.

    + * Constructs a new AllOtherUsersLogoutForm object.

    + * Constructs a new IndividualUserLogoutForm object.

    The class namespace is still missing.

  • Assigned to nitin_lama
  • Status changed to Needs review about 1 year ago
  • šŸ‡®šŸ‡³India nitin_lama

    Addressed #19. Updated patch.

  • Issue was unassigned.
  • Hi, patch #21 applied cleanly and changes suggested in #19 has been addressed in the patch #21
    Thankyou.

  • šŸ‡®šŸ‡³India Yashaswi18

    Fixed the remaining Phpcs issues in this patch. Please review.

  • šŸ‡®šŸ‡³India Preethy_ray

    Hi,
    Applied patch #24 is applied cleanly and errors are fixed.But line extends characters warning are showing up.

    
    FILE: /force_users_logout/src/Controller/AutocompleteController.php
    ----------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------
     33 | WARNING | Line exceeds 80 characters; contains 90 characters
    ----------------------------------------------------------------------------
    
    
    FILE: /force_users_logout/src/Form/AllOtherUsersLogoutForm.php
    ----------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------
     39 | WARNING | Line exceeds 80 characters; contains 85 characters
    ----------------------------------------------------------------------------
    
    
    FILE: /force_users_logout/src/Form/RoleBasedLogoutForm.php
    ----------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------
     39 | WARNING | Line exceeds 80 characters; contains 81 characters
    ----------------------------------------------------------------------------
    
    
    FILE: /force_users_logout/src/Form/IndividualUserLogoutForm.php
    ----------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------
     40 | WARNING | Line exceeds 80 characters; contains 86 characters
    ----------------------------------------------------------------------------
    
  • šŸ‡®šŸ‡³India dev16.addweb

    Hello,
    I reviewed all the issues and fixed all the problems reported by phpcs. Please review the attached patch.

  • Status changed to RTBC 23 days ago
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi @silvi.addweb,

    I applied patch #26. It was applied smoothly and fixed all the issues reported by phpcs.

    āžœ  force_users_logout git:(2.0.x) curl https://www.drupal.org/files/issues/2024-05-31/force_users_logout-3340141-26.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 15210  100 15210    0     0  37128      0 --:--:-- --:--:-- --:--:-- 37097
    patching file README.md
    patching file src/Controller/AutocompleteController.php
    patching file src/Form/AllOtherUsersLogoutForm.php
    patching file src/Form/IndividualUserLogoutForm.php
    patching file src/Form/RoleBasedLogoutForm.php
    āžœ  force_users_logout git:(2.0.x) āœ— ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml force_users_logout
    āžœ  contrib git:(main) āœ—

    Thank you.

  • Pipeline finished with Success
    23 days ago
    Total: 170s
    #187383
  • Status changed to Needs work 23 days ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Status changed to Needs review 23 days ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Pipeline finished with Success
    23 days ago
    Total: 130s
    #187394
  • Status changed to Needs work 16 days ago
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi @apaderno,

    I applied MR!13 and it was applied smoothly.

    However, I still encounter some issues after I ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml.

    āžœ  force_users_logout git:(2.0.x) curl https://git.drupalcode.org/project/force_users_logout/-/merge_requests/13.diff | git apply -v
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 14951    0 14951    0     0  33067      0 --:--:-- --:--:-- --:--:-- 33150
    Checking patch .gitlab-ci.yml...
    Checking patch src/Controller/AutocompleteController.php...
    Checking patch src/Form/AllOtherUsersLogoutForm.php...
    Checking patch src/Form/IndividualUserLogoutForm.php...
    Checking patch src/Form/RoleBasedLogoutForm.php...
    Applied patch .gitlab-ci.yml cleanly.
    Applied patch src/Controller/AutocompleteController.php cleanly.
    Applied patch src/Form/AllOtherUsersLogoutForm.php cleanly.
    Applied patch src/Form/IndividualUserLogoutForm.php cleanly.
    Applied patch src/Form/RoleBasedLogoutForm.php cleanly.
    āžœ  force_users_logout git:(2.0.x) āœ— ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml force_users_logout
    
    FILE: ...nterns/Demo-site/drupal-org-issues/web/modules/contrib/force_users_logout/README.md
    -----------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
    -----------------------------------------------------------------------------------------
      7 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
     10 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
     69 | ERROR   | [x] Expected 1 newline at end of file; 0 found
    -----------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------
    
    
    FILE: ...issues/web/modules/contrib/force_users_logout/src/Form/IndividualUserLogoutForm.php
    -----------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
       |       |     Drupal\Core\Entity\EntityTypeManagerInterface.
    -----------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------
    
    Time: 481ms; Memory: 10MB
    
    āžœ  contrib git:(main) āœ—

    Thank you.

  • Status changed to Needs review 16 days ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Pipeline finished with Success
    16 days ago
    Total: 140s
    #193774
  • Status changed to Needs work 14 days ago
  • šŸ‡®šŸ‡³India dev16.addweb

    Hi, Need to fix errors/warnings in README.md file

    modules/custom/force_users_logout-3340141/
    
    FILE: /home/addweb/Drupal8-vagrant/web/web/contribution/drupal-10-3/web/modules/custom/force_users_logout-3340141/README.md
    ---------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
    ---------------------------------------------------------------------------------------------------------------------------
      7 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
     10 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
     69 | ERROR   | [x] Expected 1 newline at end of file; 0 found
    ---------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------
    
    Time: 121ms; Memory: 10MB
    
  • Status changed to Needs review 14 days ago
  • Pipeline finished with Success
    14 days ago
    Total: 170s
    #195260
  • Status changed to RTBC 10 days ago
  • šŸ‡®šŸ‡³India Diwakar07

    Hi,

    I reviewed MR !13.
    PHP_CodeSniffer job is passed/green in the Gitlab CI reports.
    Looks good to me.

    Moving to RTBC.

  • Status changed to Needs work 10 days ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Pipeline finished with Success
    10 days ago
    Total: 140s
    #198286
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
Production build 0.69.0 2024