Fix the issues reported by phpcs

Created on 28 June 2023, 12 months ago
Updated 10 June 2024, 18 days ago
📌 Task
Status

Needs review

Version

1.0

Component

Code

Created by

🇮🇳India Prachi6824

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 @Prachi6824
  • Assigned to Prachi6824
  • Status changed to Needs review 12 months ago
  • 🇮🇳India Prachi6824

    Hello,

    I have created a patch to solve all the errors related to phpcs within the module

    Please review and apply it .

  • Issue was unassigned.
  • Status changed to Needs work 5 months ago
  • 🇵🇭Philippines paraderojether

    Hi

    I checked MR!2, and the MR is empty. I reviewed patch #2 and applied, and there are still warnings/errors reported by phpcs shown below:

    FILE: /Users/jetherparadero/d_o/drupal-issues/web/modules/contrib/term_manager/term_manager.module
    ------------------------------------------------------------------------------------------------------------
    FOUND 9 ERRORS AND 3 WARNINGS AFFECTING 10 LINES
    ------------------------------------------------------------------------------------------------------------
      1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line
      1 | ERROR   | [x] Missing file doc comment
      2 | WARNING | [x] Unused use statement
      3 | WARNING | [x] Unused use statement
      3 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Url.
      4 | WARNING | [x] Unused use statement
      6 | ERROR   | [x] Perl-style comments are not allowed; use "// Comment" instead
      7 | ERROR   | [x] Perl-style comments are not allowed; use "// Comment" instead
      8 | ERROR   | [x] Perl-style comments are not allowed; use "// Comment" instead
      9 | ERROR   | [x] Perl-style comments are not allowed; use "// Comment" instead
     10 | ERROR   | [x] Perl-style comments are not allowed; use "// Comment" instead
     11 | ERROR   | [x] Perl-style comments are not allowed; use "// Comment" instead
    ------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 12 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/jetherparadero/d_o/drupal-issues/web/modules/contrib/term_manager/config/install/term_manager.settings.yml
    -----------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------
     1 | ERROR | [x] Expected 1 newline at end of file; 0 found
    -----------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/jetherparadero/d_o/drupal-issues/web/modules/contrib/term_manager/term_manager.links.menu.yml
    ----------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------
     17 | ERROR | [x] Expected 1 newline at end of file; 0 found
    ----------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/jetherparadero/d_o/drupal-issues/web/modules/contrib/term_manager/term_manager.routing.yml
    -------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------
     32 | ERROR | [x] Expected 1 newline at end of file; 0 found
    -------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/jetherparadero/d_o/drupal-issues/web/modules/contrib/term_manager/term_manager.info.yml
    -----------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------
     1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
    -----------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/jetherparadero/d_o/drupal-issues/web/modules/contrib/term_manager/src/Form/TermManagerSettingsForm.php
    -------------------------------------------------------------------------------------------------------------------
    FOUND 6 ERRORS AFFECTING 4 LINES
    -------------------------------------------------------------------------------------------------------------------
      81 | ERROR | [x] Whitespace found at end of line
      97 | ERROR | [x] Whitespace found at end of line
      99 | ERROR | [x] Expected 1 space after comma in argument list; 7 found
      99 | ERROR | [x] Expected one space after the comma, 7 found
     100 | ERROR | [x] Expected 1 space after comma in argument list; 6 found
     100 | ERROR | [x] Expected one space after the comma, 6 found
    -------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/jetherparadero/d_o/drupal-issues/web/modules/contrib/term_manager/src/Form/TermManagerMoveForm.php
    -------------------------------------------------------------------------------------------------------------------------------
    FOUND 59 ERRORS AND 8 WARNINGS AFFECTING 55 LINES
    -------------------------------------------------------------------------------------------------------------------------------
       5 | WARNING | [x] Unused use statement
       6 | WARNING | [x] Unused use statement
       7 | ERROR   | [x] Perl-style comments are not allowed; use "// Comment" instead
      10 | WARNING | [x] Unused use statement
      13 | WARNING | [x] Unused use statement
      13 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\taxonomy\Entity\Vocabulary.
      14 | WARNING | [x] Unused use statement
      47 | WARNING | [ ] Line exceeds 80 characters; contains 148 characters
      47 | ERROR   | [x] Perl-style comments are not allowed; use "// Comment" instead
      48 | ERROR   | [x] Perl-style comments are not allowed; use "// Comment" instead
      49 | ERROR   | [x] Perl-style comments are not allowed; use "// Comment" instead
      50 | ERROR   | [x] Perl-style comments are not allowed; use "// Comment" instead
      51 | ERROR   | [x] Perl-style comments are not allowed; use "// Comment" instead
      86 | ERROR   | [x] Whitespace found at end of line
      91 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
      92 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
      93 | ERROR   | [x] Whitespace found at end of line
      94 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
      95 | WARNING | [ ] Line exceeds 80 characters; contains 104 characters
      95 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
      96 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
      97 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 10
      97 | ERROR   | [x] Whitespace found at end of line
      98 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 10
      99 | WARNING | [ ] Line exceeds 80 characters; contains 104 characters
      99 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 12
     100 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 10
     100 | ERROR   | [x] Whitespace found at end of line
     101 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
     102 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
     104 | ERROR   | [x] Line indented incorrectly; expected 5 spaces, found 4
     105 | ERROR   | [x] Whitespace found at end of line
     107 | ERROR   | [x] Expected 1 space after FOREACH keyword; 0 found
     108 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
     109 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
     110 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 10
     110 | ERROR   | [x] Whitespace found at end of line
     111 | ERROR   | [x] Concat operator must be surrounded by a single space
     112 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
     114 | ERROR   | [x] Whitespace found at end of line
     123 | ERROR   | [x] Whitespace found at end of line
     123 | ERROR   | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
     124 | ERROR   | [x] Whitespace found at end of line
     125 | ERROR   | [x] Expected 1 space before "="; 0 found
     126 | ERROR   | [x] Expected 1 space after FOREACH keyword; 0 found
     129 | ERROR   | [x] Whitespace found at end of line
     146 | ERROR   | [x] Perl-style comments are not allowed; use "// Comment" instead
     155 | ERROR   | [x] Whitespace found at end of line
     159 | ERROR   | [x] Whitespace found at end of line
     161 | ERROR   | [x] Whitespace found at end of line
     166 | ERROR   | [x] Whitespace found at end of line
     173 | ERROR   | [x] Inline comments must start with a capital letter
     173 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
     175 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
     176 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
     177 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
     178 | ERROR   | [x] Whitespace found at end of line
     179 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
     179 | ERROR   | [x] Perl-style comments are not allowed; use "// Comment" instead
     180 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
     180 | ERROR   | [x] Perl-style comments are not allowed; use "// Comment" instead
     180 | ERROR   | [x] Whitespace found at end of line
     182 | ERROR   | [x] Whitespace found at end of line
     186 | ERROR   | [x] Whitespace found at end of line
     187 | ERROR   | [x] Whitespace found at end of line
     189 | ERROR   | [x] Expected 1 blank line after function; 0 found
     190 | ERROR   | [x] The closing brace for the class must have an empty line before it
    -------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 64 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/jetherparadero/d_o/drupal-issues/web/modules/contrib/term_manager/src/Controller/TermManagerController.php
    ---------------------------------------------------------------------------------------------------------------------------------
    FOUND 13 ERRORS AND 2 WARNINGS AFFECTING 13 LINES
    ---------------------------------------------------------------------------------------------------------------------------------
      1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line
      4 | ERROR   | [x] Perl-style comments are not allowed; use "// Comment" instead
      5 | ERROR   | [x] Perl-style comments are not allowed; use "// Comment" instead
      6 | ERROR   | [x] Perl-style comments are not allowed; use "// Comment" instead
      9 | ERROR   | [x] You must use "/**" style comments for a class comment
     10 | ERROR   | [x] Missing function doc comment
     10 | ERROR   | [x] Expected 1 blank line before function; 0 found
     11 | ERROR   | [x] Short array syntax must be used to define arrays
     12 | WARNING | [x] A comma should follow the last multiline array item. Found: 'Welcome to Term Manager.'
     15 | ERROR   | [x] Whitespace found at end of line
     16 | ERROR   | [x] Missing function doc comment
     17 | ERROR   | [x] Short array syntax must be used to define arrays
     18 | WARNING | [x] A comma should follow the last multiline array item. Found: 'Term Manager: Move Term to another Vocabulary.'
     21 | ERROR   | [x] Expected 1 newline at end of file; 0 found
     21 | ERROR   | [x] The closing brace for the class must have an empty line before it
    ---------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 15 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------
    
    Time: 137ms; Memory: 10MB

    Moving this to Needs work.
    Thank you.

  • Assigned to mahtab_alam
  • Issue was unassigned.
  • Status changed to Needs review 5 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Status changed to Needs work 18 days ago
  • 🇮🇳India dev16.addweb

    Hi, I have tested MR and found below phpcs issues.

    modules/custom/term_manager/
    
    FILE: /home/addweb/Drupal8-vagrant/web/web/contribution/d9_contribution2/web/modules/custom/term_manager/src/Form/TermManagerMoveForm.php
    -----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 12 WARNINGS AFFECTING 12 LINES
    -----------------------------------------------------------------------------------------------------------------------------------------
      64 | WARNING | Unused variable $term_depth.
      65 | WARNING | Vocabulary::loadMultiple calls should be avoided in classes, use dependency injection instead
      70 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
      71 | WARNING | Unused variable $value.
     118 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     121 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     126 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     130 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     133 | WARNING | Term::load calls should be avoided in classes, use dependency injection instead
     137 | WARNING | Term::load calls should be avoided in classes, use dependency injection instead
     141 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     142 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    -----------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 146ms; Memory: 10MB
    
  • Status changed to Needs review 18 days ago
  • Pipeline finished with Success
    18 days ago
    Total: 140s
    #195739
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
Production build 0.69.0 2024