Opened 23 months ago
Last modified 2 weeks ago
#62166 new defect (bug)
Bundled themes: PHPCS "exactly one blank line after the file comment"
| Reported by: | dhruvang21 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Bundled Theme | Version: | |
| Severity: | minor | Keywords: | has-patch |
| Cc: | Focuses: | docs, coding-standards |
Description (last modified by )
This ticket is created to serve as the base for resolving the phpcs error such as
"There must be exactly one blank line after the file comment" for the whole codebase
Command to check for this Error :-
phpcs --standard=WordPress --extensions=php file_path
Currently the error has been resolved in the following themes:-
Twenty Thirteen, Twenty Fifteen :- By this patch 62160.patch
Twenty Fourteen: #62098 / [59158]
Twenty Sixteen: #62160
Attachments (7)
Change History (20)
@
23 months ago
Fix phpcs error for following themes: seventeen, nineteen, twenty, twenty-one, twenty-two, twenty-three,
This ticket was mentioned in PR #7500 on WordPress/wordpress-develop by @dhruvang21.
23 months ago
#3
- Keywords has-patch added
Trac ticket: https://core.trac.wordpress.org/ticket/62166
Fixes PHPCS Error :- "There must be exactly one blank line after the file comment"
#4
@
23 months ago
- Component General → Bundled Theme
- Description modified (diff)
- Severity normal → minor
- Summary PHPCS Errors → Bundled themes: PHPCS "exactly one blank line after the file comment"
#5
@
23 months ago
In PR 7500, I marked one line that should not be added in Twenty Twenty-Two's block-patterns file (out of 187 files).
Additional notes:
- The error is 'SpacingAfterComment' from PHPCS.
- Core-40039 only updated Twenty Seventeen and newer themes for different coding standards two years ago. However, [59158] already made 'SpacingAfterComment' changes for Twenty Fourteen, and consistency is good.
#6
@
23 months ago
I did not add the 'changes-requested' keyword, but what I requested is done now :)
@
22 months ago
I have checked another theme and core files and found above mentioned change. I have resolved it and added its patch for the same.
#7
@
21 months ago
Hi @dhruvang21 @mdviralsampat
When I compare the patches and the pull request, I do not see any theme related changes in the patches that are not already part of the pull request, can you please confirm this?
It is not clear to me why multiple patches were submitted.
The patches contain changes that are unrelated to the themes, and those changes must not be committed as part of this ticket.
#8
@
21 months ago
Hi @poena,
I have made changes only in the theme files since this ticket specifically addresses resolving the PHPCS issues within themes. I believe @mdviralsampat submitted a patch for the core file as well, but I have not included those changes in my PR.
@
20 months ago
I have checked twenty twenty four theme and found few files where we need to resolve phpcs errors/warnings. I have resolved it and added its patch for the same.
@sabernhardt commented on PR #7500:
19 months ago
#9
I checked each of the PHP files and found one more with an extra line (to remove): twentytwentythree\functions.php.
#10
@
19 months ago
- Focuses docs added
PR 7500 does not edit the following class files, and I am not sure whether this ticket should change them.
twentyeleven\inc\widgets.phptwentyfourteen\inc\featured-content.phptwentyfourteen\inc\widgets.php
I do not think that they should simply add an empty line between the comment and the class Featured_Content { line. However, the two widget class files seem to combine the file header and the class docblock (compared to how Twenty Nineteen separates them).
#62437 can address any edits to package/subpackage/since details in block themes such as Twenty Twenty-Four (62166.5.patch).
This ticket was mentioned in PR #12386 on WordPress/wordpress-develop by @sabernhardt.
6 weeks ago
#11
Co-authored by dhruvang21
Adds empty line below file header comment to meet PHPCS 'SpacingAfterComment' rule in classic theme PHP files if it was not already there.
- T10 (8 of 22)
- T11 (15 of 33, including
inc/widgets.php) - T12 (7 of 28)
- T13 (14 of 32)
- T14 (3 of 39, including
inc/featured-content.phpandinc/widgets.php) - T15 (8 of 23)
- T19 (1 of 31)
Additional changes:
- Splitting the file header comment from the class docblock for the
Twenty_Eleven_Ephemera_Widget,Twenty_Fourteen_Ephemera_Widget, andFeatured_Contentclasses. - Adding the
sincenote intwentyeleven/index.php. - Correcting the version number format in
twentynineteen/inc/back-compat.php.
Use of AI Tools: none by me
@sabernhardt commented on PR #7500:
6 weeks ago
#12
@wildworks commented on PR #7500:
2 weeks ago
#13
The issue with block themes was fixed in r62867. By merging the trunk branch into this PR, this PR ultimately only contains changes to classic themes.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
hello @mukesh27,
Command you asked for checking the error is mentioned in the ticket description and working on resolving the error by creating Patch for the other theme as well.