Fix Coding Standard Issues

Created on 6 December 2023, 7 months ago
Updated 22 December 2023, 6 months ago

Problem/Motivation

1: README.md file missing:

In Drupal, the README.md file provides documentation and guidance to users, developers, and contributors. here is the link for creating a README.md file with the write pattern: README.md ā†’ template.

2: hook_help() missing from auto_promote.module file.

In Drupal, the hook_help function is used to provide help documentation for your custom module. This documentation is displayed on the Help page of your Drupal site, making it accessible to administrators and users.

I've attached a patch of hook_help() for this module.

3: Fix the issues reported by phpcs

Steps Reproduce

. After Installed and enabled Run the below command on the composer-

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

FILE: /web/modules/contrib/auto_promote/auto_promote.info.yml                                      
-------------------------------------------------------------------------------------------------------------                 
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE                                                                                
-------------------------------------------------------------------------------------------------------------                 
 1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically                    
 1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically                  
 1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically                    
-------------------------------------------------------------------------------------------------------------                 
                                                                                                                              
                                                                                                                              
FILE: /web/modules/contrib/auto_promote/auto_promote.module                                        
--------------------------------------------------------------------------------------                                        
FOUND 2 ERRORS AFFECTING 1 LINE                                                                                               
--------------------------------------------------------------------------------------                                        
 1 | ERROR | [x] Missing file doc comment                                                                                     
 1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line                                                  
--------------------------------------------------------------------------------------                                        
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY                                                                    
--------------------------------------------------------------------------------------                                        
                                                                                                                              
                                                                                                                              
FILE: /web/modules/contrib/auto_promote/src/Form/AutoPromoteSettingsForm.php                       
------------------------------------------------------------------------------------------------------------------------------
FOUND 38 ERRORS AND 2 WARNINGS AFFECTING 32 LINES                                                                             
------------------------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line                                               
  1 | ERROR   | [x] Whitespace found at end of line                                                                           
  9 | ERROR   | [x] Missing class doc comment                                                                                 
 11 | ERROR   | [ ] Missing member variable doc comment                                                                       
 13 | ERROR   | [x] Missing function doc comment                                                                              
 17 | ERROR   | [x] Missing function doc comment                                                                              
 23 | ERROR   | [x] Missing function doc comment                                                                              
 27 | ERROR   | [x] Missing function doc comment                                                                              
 31 | ERROR   | [x] Missing function doc comment                                                                              
 34 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses 
 36 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8                                                    
 39 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses 
 41 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8                                                    
 42 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8                                                    
 43 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8                                                    
 43 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters                                                        
 43 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses 
 43 | ERROR   | [x] Comments may not appear after statements                                                                  
 48 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8                                                    
 49 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8                                                    
 50 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8                                                    
 51 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8                                                    
 54 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8                                                    
 57 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses 
 59 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8                                                    
 60 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8                                                    
 61 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8                                                    
 61 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters                                                        
 61 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses 
 61 | ERROR   | [x] Comments may not appear after statements                                                                  
 66 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8                                                    
 67 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8                                                    
 68 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8                                                    
 69 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8                                                    
 72 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8                                                    
 76 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 0                                                     
 76 | ERROR   | [x] Closing brace indented incorrectly; expected 2 spaces, found 0                                            
 78 | ERROR   | [x] Missing function doc comment                                                                              
 85 | ERROR   | [x] Expected 1 blank line after function; 0 found                                                             
 86 | ERROR   | [x] The closing brace for the class must have an empty line before it                                         
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 37 MARKED SNIFF VIOLATIONS AUTOMATICALLY                                                                   
------------------------------------------------------------------------------------------------------------------------------
šŸ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India aman_lnwebworks

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @aman_lnwebworks
  • First commit to issue fork.
  • Merge request !1Fixed phpcs issues ā†’ (Open) created by Neha-Verma
  • šŸ‡®šŸ‡³India Neha-Verma

    Fixed the issues reported by phpcs. Please review. Thanks.

  • Status changed to Needs review 6 months ago
  • Status changed to Needs work 6 months ago
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi

    I applied the MR !1 and I confirmed that it fixes all the PHPCS errors but there is a file in the patch that is rejected, hence moving this to needs work.

    āžœ  auto_promote git:(master) āœ— curl https://git.drupalcode.org/project/auto_promote/-/merge_requests/1.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  8171    0  8171    0     0  15731      0 --:--:-- --:--:-- --:--:-- 16021
    patching file README.md
    patching file auto_promote.info.yml
    1 out of 1 hunks failed--saving rejects to auto_promote.info.yml.rej
    patching file auto_promote.module
    patching file 'src/Form/AutoPromoteSettingsForm.php'
    āžœ  auto_promote git:(master) āœ— ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml auto_promote
    
    FILE: /Users/clarksubing-subing/Projects/d9/d9-local/web/modules/contrib/auto_promote/auto_promote.info.yml
    -------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------
     1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
    -------------------------------------------------------------------------------------------------------------
    
    Time: 199ms; Memory: 10MB
    
    āžœ  contrib git:(master) āœ—
  • Assigned to nitin_lama
  • šŸ‡®šŸ‡³India nitin_lama

    Please review.

  • Issue was unassigned.
  • Status changed to Needs review 6 months ago
Production build 0.69.0 2024