Make WordPress Core

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 sabernhardt)

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)

phpcs-error.png (22.4 KB ) - added by dhruvang21 23 months ago.
62166.patch (82.5 KB ) - added by parthvataliya 23 months ago.
Fix phpcs error for following themes:
62166.2.patch (82.5 KB ) - added by parthvataliya 23 months ago.
Fix phpcs error for following themes:
62166.3.patch (82.5 KB ) - added by parthvataliya 23 months ago.
Fix phpcs error for following themes: seventeen, nineteen, twenty, twenty-one, twenty-two, twenty-three,
fix-62166.patch (9.1 KB ) - added by dhruvang21 23 months ago.
Fixes phpcs error for theme twentyeleven and twentytwelve
62166.4.patch (12.3 KB ) - added by mdviralsampat 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.
62166.5.patch (31.6 KB ) - added by viralsampat 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.

Download all attachments as: .zip

Change History (20)

#1 @dhruvang21
23 months ago

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.

@parthvataliya
23 months ago

Fix phpcs error for following themes:

@parthvataliya
23 months ago

Fix phpcs error for following themes:

@parthvataliya
23 months ago

Fix phpcs error for following themes: seventeen, nineteen, twenty, twenty-one, twenty-two, twenty-three,

@dhruvang21
23 months ago

Fixes phpcs error for theme twentyeleven and twentytwelve

#2 @nithins53
23 months ago

Guess this covers all the themes now.

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 @sabernhardt
23 months ago

  • Component GeneralBundled Theme
  • Description modified (diff)
  • Severity normalminor
  • Summary PHPCS ErrorsBundled themes: PHPCS "exactly one blank line after the file comment"

#5 @sabernhardt
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 @sabernhardt
23 months ago

I did not add the 'changes-requested' keyword, but what I requested is done now :)

@mdviralsampat
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 @poena
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 @dhruvang21
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.

@viralsampat
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 @sabernhardt
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.php
  • twentyfourteen\inc\featured-content.php
  • twentyfourteen\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.php and inc/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, and Featured_Content classes.
  • Adding the since note in twentyeleven/index.php.
  • Correcting the version number format in twentynineteen/inc/back-compat.php.

Trac 62166

Use of AI Tools: none by me

@sabernhardt commented on PR #7500:


6 weeks ago
#12

I built off of this to make #12386, focusing on the classic themes because #8379 can add the empty lines for the block themes.

@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.

Note: See TracTickets for help on using tickets.