Fix the issues reported by phpcs

Created on 10 February 2023, almost 2 years ago
Updated 28 June 2023, over 1 year ago

Problem/Motivation

Phpcs issue found

FILE: /Users/studenttrainees/Drupal.org/drupalorg-site/docroot/modules/contrib/login_popup/README.md
----------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------
 45 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------

Time: 202ms; Memory: 10MB

Steps to reproduce

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig login_pupop

Proposed resolution

Fix phpcs issue.

📌 Task
Status

Needs review

Version

2.0

Component

Code

Created by

🇮🇳India sidharth_soman Bangalore

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 @sidharth_soman
  • Status changed to Needs work almost 2 years ago
  • 🇮🇳India sidharth_soman Bangalore

    Finding the following issues. I'll work on them.

    C:\xampp\htdocs\backendassignment\web\modules\contrib>phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig login_popup-3340823
    
    FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\login_popup-3340823\login_popup.info.yml
    ----------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------
     1 | WARNING | "core_version_requirement" property is missing in the info.yml file
    ----------------------------------------------------------------------------------------------------
    
    
    FILE: ...\xampp\htdocs\backendassignment\web\modules\contrib\login_popup-3340823\src\Plugin\Block\LoginAndRegisterPopup.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 8 ERRORS AND 3 WARNINGS AFFECTING 10 LINES
    ------------------------------------------------------------------------------------------------------------------------
      1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
      7 | ERROR   | [x] There must be one blank line after the last USE statement; 2 found;
      7 | ERROR   | [x] When importing a class with "use", do not include a leading \
     24 | ERROR   | [x] Expected 1 blank line before function; 2 found
     27 | ERROR   | [x] Short array syntax must be used to define arrays
     28 | ERROR   | [x] Short array syntax must be used to define arrays
     29 | ERROR   | [x] Short array syntax must be used to define arrays
     38 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait
        |         |     and $this->t() instead
     39 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait
        |         |     and $this->t() instead
     41 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
     44 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
    ------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\login_popup-3340823\src\Plugin\Block\LoginFormPopup.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 8 ERRORS AND 2 WARNINGS AFFECTING 9 LINES
    ------------------------------------------------------------------------------------------------------------------------
      1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
      7 | ERROR   | [x] There must be one blank line after the last USE statement; 2 found;
      7 | ERROR   | [x] When importing a class with "use", do not include a leading \
     24 | ERROR   | [x] Expected 1 blank line before function; 2 found
     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
     36 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait
        |         |     and $this->t() instead
     38 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
     41 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
    ------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\login_popup-3340823\src\Plugin\Block\RegisterFormPopup.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 8 ERRORS AND 2 WARNINGS AFFECTING 9 LINES
    ------------------------------------------------------------------------------------------------------------------------
      1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
      7 | ERROR   | [x] There must be one blank line after the last USE statement; 2 found;
      7 | ERROR   | [x] When importing a class with "use", do not include a leading \
     24 | ERROR   | [x] Expected 1 blank line before function; 2 found
     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
     36 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait
        |         |     and $this->t() instead
     38 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
     41 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
    ------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------
    
    Time: 709ms; Memory: 4MB
    
    
    C:\xampp\htdocs\backendassignment\web\modules\contrib>phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig login_popup-3340823
    
    FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\login_popup-3340823\login_popup.info.yml
    ----------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------
     1 | WARNING | "core_version_requirement" property is missing in the info.yml file
    ----------------------------------------------------------------------------------------------------
    
    
    FILE: ...\xampp\htdocs\backendassignment\web\modules\contrib\login_popup-3340823\src\Plugin\Block\LoginAndRegisterPopup.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 8 ERRORS AND 3 WARNINGS AFFECTING 10 LINES
    ------------------------------------------------------------------------------------------------------------------------
      1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
      7 | ERROR   | [x] There must be one blank line after the last USE statement; 2 found;
      7 | ERROR   | [x] When importing a class with "use", do not include a leading \
     24 | ERROR   | [x] Expected 1 blank line before function; 2 found
     27 | ERROR   | [x] Short array syntax must be used to define arrays
     28 | ERROR   | [x] Short array syntax must be used to define arrays
     29 | ERROR   | [x] Short array syntax must be used to define arrays
     38 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait
        |         |     and $this->t() instead
     39 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait
        |         |     and $this->t() instead
     41 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
     44 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
    ------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\login_popup-3340823\src\Plugin\Block\LoginFormPopup.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 8 ERRORS AND 2 WARNINGS AFFECTING 9 LINES
    ------------------------------------------------------------------------------------------------------------------------
      1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
      7 | ERROR   | [x] There must be one blank line after the last USE statement; 2 found;
      7 | ERROR   | [x] When importing a class with "use", do not include a leading \
     24 | ERROR   | [x] Expected 1 blank line before function; 2 found
     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
     36 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait
        |         |     and $this->t() instead
     38 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
     41 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
    ------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\login_popup-3340823\src\Plugin\Block\RegisterFormPopup.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 8 ERRORS AND 2 WARNINGS AFFECTING 9 LINES
    ------------------------------------------------------------------------------------------------------------------------
      1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
      7 | ERROR   | [x] There must be one blank line after the last USE statement; 2 found;
      7 | ERROR   | [x] When importing a class with "use", do not include a leading \
     24 | ERROR   | [x] Expected 1 blank line before function; 2 found
     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
     36 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait
        |         |     and $this->t() instead
     38 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
     41 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
    ------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------
    
    Time: 882ms; Memory: 4MB
    
  • 🇮🇳India sidharth_soman Bangalore

    Fixed all the issues except dependency injection. Please review.

  • Issue was unassigned.
  • Status changed to RTBC over 1 year ago
  • Good to merge
    Patch looks fine

  • 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.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India Ashutosh Ahirwal India

    I have updated the issue summary which we added in #2.

  • Assigned to paraderojether
  • Status changed to Needs work over 1 year ago
  • 🇵🇭Philippines paraderojether

    Hi I after running this command: "phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig" without applying any patch and I'm getting a different result on my end.

    FILE: /Users/studenttrainees/Drupal.org/drupalorg-site/docroot/modules/contrib/login_popup/README.md
    ----------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------
     45 | ERROR | [x] Expected 1 newline at end of file; 0 found
    ----------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------
    
    Time: 202ms; Memory: 10MB
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇵🇭Philippines paraderojether

    Created a patch to fix the issue.

    Please review.
    Thank You.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    The patch in #9 is not complete. The patch in #3 changes three files while the report shows errors/warnings for four files.

  • Assigned to nitin_lama
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India nitin_lama India

    Only one error on 2.x branch. On the 2.x branch, Patch #3 is inapplicable. The remaining error is fixed in patch #9. IS needs to be updated.

  • Issue was unassigned.
  • Status changed to Needs work over 1 year ago
  • Status changed to Needs review over 1 year ago
  • 🇵🇭Philippines paraderojether

    I updated the Issue Summary, please review patch #9 again.

    Thank You

Production build 0.71.5 2024