Fix the issues reported by phpcs

Created on 5 July 2023, 12 months ago
Updated 8 February 2024, 5 months ago

Problem/Motivation

FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/ata_st/dscm/config/install/didsomeonecloneme.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/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/ata_st/dscm/didsomeonecloneme.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/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/ata_st/dscm/didsomeonecloneme.module
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 20 ERRORS 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
8 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
8 | ERROR | [x] No space found before comment text; expected "// get did someone clone me url from configuration" but found "//get did someone clone me url from configuration"
8 | ERROR | [x] Inline comments must start with a capital letter
8 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
9 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
10 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
10 | ERROR | [x] Expected 1 space after IF keyword; 0 found
10 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
11 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
11 | ERROR | [x] Inline comments must start with a capital letter
11 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
12 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
12 | ERROR | [x] Concat operator must be surrounded by a single space
12 | ERROR | [x] Concat operator must be surrounded by a single space
13 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
14 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
15 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
17 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 20 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/ata_st/dscm/README.txt
-------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------
1 | WARNING | [ ] File has mixed line endings; this may cause incorrect results
1 | WARNING | [ ] File encoding is invalid, expected UTF-8
1 | ERROR | [ ] File contains UTF-16 (LE) byte order mark, which may corrupt your application
2 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------

FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/ata_st/dscm/src/Form/SettingsForm.php
-------------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AND 3 WARNINGS AFFECTING 7 LINES
-------------------------------------------------------------------------------------------------------------------------------
9 | WARNING | [x] Unused use statement
78 | WARNING | [x] A comma should follow the last multiline array item. Found: )
80 | ERROR | [x] Whitespace found at end of line
94 | WARNING | [ ] Do not pass empty strings to t()
105 | ERROR | [x] Inline comments must start with a capital letter
105 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
125 | ERROR | [x] Expected 1 blank line after function; 0 found
126 | ERROR | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------

Time: 241ms; Memory: 10MB

Steps to reproduce

Execute the command:
./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml web/modules/custom/dscm

Remaining tasks

Fix the issue raised by phpcs

📌 Task
Status

Needs review

Version

1.0

Component

Code

Created by

🇮🇳India urvashi_vora Madhya Pradesh, India

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 @urvashi_vora
  • Status changed to Needs work 5 months ago
  • 🇮🇳India Ashutosh Ahirwal India

    Updating the Issue summary.
    it showing only few error in readme file only.

  • 🇮🇳India Yashaswi18

    The above patch was not applying. Please review this patch.

  • 🇮🇳India zkhan.aamir

    Hi,

    Patch #4 applied successfully.

    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules/contrib/dscm (1.0.0)
    $ curl https://www.drupal.org/files/issues/2024-01-23/3372533-coding-standards-fixes.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  3046  100  3046    0     0   5580      0 --:--:-- --:--:-- --:--:--  5599
    patching file config/install/didsomeonecloneme.settings.yml
    patching file didsomeonecloneme.module
    patching file src/Form/SettingsForm.php
    

    Still some issues remianing.

    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules/contrib
    $ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,js,yml dscm/
    
    FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\contrib\dscm\didsomeonecloneme.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: C:\Users\Admin\Desktop\projects\drupal\web\modules\contrib\dscm\didsomeonecloneme.module
    ----------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------
     3 | ERROR | Missing short description in doc comment
    ----------------------------------------------------------------------------------------------
    
    
    FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\contrib\dscm\README.txt
    -------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    -------------------------------------------------------------------------------------------------
     1 | WARNING | [ ] File has mixed line endings; this may cause incorrect results
     1 | WARNING | [ ] File encoding is invalid, expected UTF-8
     1 | ERROR   | [ ] File contains UTF-16 (LE) byte order mark, which may corrupt your application
     2 | ERROR   | [x] Expected 1 newline at end of file; 0 found
    -------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------
    
    
    FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\contrib\dscm\src\Form\SettingsForm.php
    -----------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------
     93 | WARNING | Do not pass empty strings to t()
    -----------------------------------------------------------------------------------------------
    
    Time: 218ms; Memory: 10MB
    
  • Assigned to nitin_lama
  • 🇮🇳India nitin_lama

    Providing updated patch.

  • 🇮🇳India nitin_lama

    Please review.

  • Issue was unassigned.
  • Status changed to Needs review 5 months ago
  • Hi, The patch provided in #7 applies cleanly, still could see some errors and warning. Attaching ss for reference

Production build 0.69.0 2024