Make WordPress Core

Opened 6 months ago

Last modified 2 months ago

#62166 new defect (bug)

Bundled themes: PHPCS "exactly one blank line after the file comment"

Reported by: dhruvang21's profile dhruvang21 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version:
Component: Bundled Theme Keywords: has-patch
Focuses: docs, coding-standards Cc:

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 6 months ago.
62166.patch (82.5 KB) - added by parthvataliya 6 months ago.
Fix phpcs error for following themes:
62166.2.patch (82.5 KB) - added by parthvataliya 6 months ago.
Fix phpcs error for following themes:
62166.3.patch (82.5 KB) - added by parthvataliya 6 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 6 months ago.
Fixes phpcs error for theme twentyeleven and twentytwelve
62166.4.patch (12.3 KB) - added by mdviralsampat 6 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 4 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 (17)

#1 @dhruvang21
6 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
6 months ago

Fix phpcs error for following themes:

@parthvataliya
6 months ago

Fix phpcs error for following themes:

@parthvataliya
6 months ago

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

@dhruvang21
6 months ago

Fixes phpcs error for theme twentyeleven and twentytwelve

#2 @nithins53
6 months ago

Guess this covers all the themes now.

This ticket was mentioned in PR #7500 on WordPress/wordpress-develop by @dhruvang21.


6 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
6 months ago

  • Component changed from General to Bundled Theme
  • Description modified (diff)
  • Severity changed from normal to minor
  • Summary changed from PHPCS Errors to Bundled themes: PHPCS "exactly one blank line after the file comment"

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

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

@mdviralsampat
6 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
4 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
4 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
4 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:


2 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
2 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).

Note: See TracTickets for help on using tickets.