Fix the issues reported by phpcs

Created on 5 July 2023, almost 2 years ago

Problem/Motivation

FILE: /var/www/html/vb/d_cont/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: /var/www/html/vb/d_cont/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: /var/www/html/vb/d_cont/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
-------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/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: /var/www/html/vb/d_cont/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
--------------------------------------------------------------------------------

Time: 71ms; Memory: 10MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig dscm/\

Remaining tasks

Patch review

📌 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 about 1 year 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 India

    Providing updated patch.

  • 🇮🇳India nitin_lama India

    Please review.

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

  • Status changed to Needs work 9 months ago
  • Hi @nitin_lama,

    Your patch was applied not-so successfully, might be the reason errors are still reported. Please see below:
    Applying of patch:

    dscm git:(main) ✗ curl https://www.drupal.org/files/issues/2024-01-24/3372533-coding-standards-fixes-7.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  3535  100  3535    0     0  11761      0 --:--:-- --:--:-- --:--:-- 12189
    patching file config/install/didsomeonecloneme.settings.yml
    patching file didsomeonecloneme.info.yml
    Hunk #1 FAILED at 2.
    1 out of 1 hunk FAILED -- saving rejects to file didsomeonecloneme.info.yml.rej
    patching file didsomeonecloneme.module
    patching file src/Form/SettingsForm.php
    
    ➜  contrib git:(main) ✗ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig dscm
    
    FILE: ...rometInterns/Demo-site/drupal-orgissue/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: ...mo-site/drupal-orgissue/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: 145ms; Memory: 10MB

    Kindly check

    Thanks,
    Jake

  • Assigned to amit.rawat777
  • 🇮🇳India amit.rawat777

    Hi, I am working on this.

  • 🇮🇳India amit.rawat777

    I have fixed the issues. please verify.

  • First commit to issue fork.
Production build 0.71.5 2024