Fix the issues reported by phpcs

Created on 15 July 2024, 4 months ago
Updated 28 August 2024, 3 months ago

Problem/Motivation

Running :-
vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig web/modules/contrib/content_type_audit/

returns the following warnings/errors, which should be fixed.

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/content_type_audit/css/content_audit.css
-----------------------------------------------------------------------------------------------------
FOUND 11 ERRORS AFFECTING 9 LINES
-----------------------------------------------------------------------------------------------------
2 | ERROR | [x] Selectors must be on a single line
3 | ERROR | [x] Selectors must be on a single line
4 | ERROR | [ ] Style definitions must end with a semicolon
12 | ERROR | [x] Selectors must be on a single line
13 | ERROR | [x] Selectors must be on a single line
14 | ERROR | [x] Selectors must be on a single line
15 | ERROR | [x] Selectors must be on a single line
16 | ERROR | [x] Multiple selectors should each be on a single line
16 | ERROR | [x] Multiple selectors should each be on a single line
16 | ERROR | [ ] Style definitions must end with a semicolon
21 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
-----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/content_type_audit/content_type_audit.links.menu.yml
-----------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Expected 1 newline at end of file; 0 found
-----------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/content_type_audit/README.md
-----------------------------------------------------------------------------------------
FOUND 1 ERROR AND 7 WARNINGS AFFECTING 8 LINES
-----------------------------------------------------------------------------------------
3 | WARNING | [ ] Line exceeds 80 characters; contains 121 characters
8 | WARNING | [ ] Line exceeds 80 characters; contains 93 characters
9 | WARNING | [ ] Line exceeds 80 characters; contains 133 characters
10 | WARNING | [ ] Line exceeds 80 characters; contains 83 characters
14 | WARNING | [ ] Line exceeds 80 characters; contains 91 characters
15 | WARNING | [ ] Line exceeds 80 characters; contains 98 characters
16 | WARNING | [ ] Line exceeds 80 characters; contains 97 characters
32 | ERROR | [x] Expected 1 newline at end of file; 0 found
-----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/content_type_audit/content_type_audit.routing.yml
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
7 | WARNING | [ ] The administration page callback should probably use "administer site configuration" - which implies the user can change something - rather than "access
| | administration pages" which is about viewing but not changing configurations.
7 | ERROR | [x] Expected 1 newline at end of file; 0 found
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/content_type_audit/src/Form/ContentReport.php
----------------------------------------------------------------------------------------------------------
FOUND 103 ERRORS AFFECTING 100 LINES
----------------------------------------------------------------------------------------------------------
15 | ERROR | [x] Opening brace should be on the same line as the declaration
16 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
21 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
23 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
28 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
30 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
33 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
35 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
41 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
42 | ERROR | [x] Opening brace should be on the same line as the declaration
43 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
44 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
45 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
46 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
48 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
51 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
52 | ERROR | [x] Opening brace should be on the same line as the declaration
53 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
56 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
58 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
61 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
62 | ERROR | [x] Opening brace should be on the same line as the declaration
63 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
64 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
66 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
69 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
70 | ERROR | [x] Opening brace should be on the same line as the declaration
71 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
72 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
73 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
74 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
75 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
76 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
77 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
78 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
79 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
81 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
82 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
83 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
87 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
88 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
89 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
91 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
92 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
93 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
95 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
98 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
99 | ERROR | [x] Opening brace should be on the same line as the declaration
100 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
101 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
102 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
104 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
106 | ERROR | [x] Whitespace found at end of line
107 | ERROR | [x] Whitespace found at end of line
108 | ERROR | [x] Return comment indentation must be 3 spaces, found 1 spaces
110 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
111 | ERROR | [x] Opening brace should be on the same line as the declaration
112 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
113 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
114 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
115 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
116 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
117 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
118 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
119 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
120 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
120 | ERROR | [x] Expected newline after closing brace
121 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
122 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
123 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
124 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
125 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
126 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
127 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
128 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
129 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
130 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
134 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
135 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
136 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
137 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
138 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
139 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
140 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 20
141 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
141 | ERROR | [x] Expected newline after closing brace
142 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 20
143 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
143 | ERROR | [x] Expected newline after closing brace
144 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 20
145 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
146 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
147 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
148 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
149 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
150 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
151 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
152 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
154 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
157 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
158 | ERROR | [x] Opening brace should be on the same line as the declaration
159 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
160 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 103 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/content_type_audit/content_type_audit.libraries.yml
----------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------
5 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------

📌 Task
Status

Fixed

Version

1.2

Component

Code

Created by

🇮🇳India prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan

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 @prem suthar
  • Assigned to sarwan_verma
  • Merge request !2Resolve #3461463 "Fix the issues" → (Merged) created by Unnamed author
  • Issue was unassigned.
  • Status changed to Needs review 4 months ago
  • 🇮🇳India sarwan_verma

    Hi @Prem Suthar,
    I have fixed all PHPCS errors and created MR!2. For additional clarity, please refer to the attached screenshot.
    Kindly review and verify.
    thanks.

  • Status changed to Needs work 4 months ago
  • Hi @sarwan_verma,

    Your changes on MR2 was applied unsuccessfully, please see below:

    content_type_audit git:(1.1.0) ✗ curl https://git.drupalcode.org/project/content_type_audit/-/merge_requests/2.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  7248    0  7248    0     0  19794      0 --:--:-- --:--:-- --:--:-- 20359
    patching file README.md
    Hunk #1 FAILED at 1.
    Hunk #2 FAILED at 29.
    2 out of 2 hunks FAILED -- saving rejects to file README.md.rej
    patching file content_type_audit.info.yml
    Reversed (or previously applied) patch detected!  Assume -R? [n] y
    patching file content_type_audit.libraries.yml
    patching file content_type_audit.links.menu.yml
    patching file content_type_audit.routing.yml
    patching file css/content_audit.css
    patching file src/Form/ContentReport.php
    Hunk #1 FAILED at 48.
    Hunk #2 FAILED at 97.
    Hunk #3 FAILED at 122.
    Hunk #4 FAILED at 154.
    4 out of 4 hunks FAILED -- saving rejects to file src/Form/ContentReport.php.rej

    Kindly check

    Thanks,
    Jake

  • Status changed to RTBC 4 months ago
  • 🇮🇳India dev2.addweb

    Hi,
    I have tested MR, it has been successfully applied. Additionally, there are no more PHPCS errors or warnings found. Moving to RTBC

    modules/custom/content_type_audit$ curl https://git.drupalcode.org/project/content_type_audit/-/merge_requests/2.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  7248    0  7248    0     0  14183      0 --:--:-- --:--:-- --:--:-- 14156
    patching file README.md
    patching file content_type_audit.info.yml
    patching file content_type_audit.libraries.yml
    patching file content_type_audit.links.menu.yml
    patching file content_type_audit.routing.yml
    patching file css/content_audit.css
    patching file src/Form/ContentReport.php
    
    addweb@addweb-HP-ZBook-15-G2:~$ .config/composer/vendor/squizlabs/php_codesniffer/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css Drupal8-vagrant/web/web/contribution/lando-d10/web/modules/custom/content_type_audit/
    addweb@addweb-HP-ZBook-15-G2:~$ 
  • Status changed to Fixed 3 months ago
  • 🇮🇳India chiragkparikh

    Thank you all for your contribution!

  • Status changed to Fixed 3 months ago
Production build 0.71.5 2024