Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#44366 closed enhancement (fixed)

Update PHPCS ruleset for WP Core and related Composer setup

Reported by: jrf's profile jrf Owned by: jrf's profile jrf
Milestone: 5.0 Priority: normal
Severity: normal Version: 5.1
Component: Build/Test Tools Keywords: has-patch commit
Focuses: coding-standards Cc:

Description

This update the core native PHPCS ruleset

.gitignore:

  • Add the typical filenames of overloaded PHPCS configs to .gitignore.

Composer:

  • Use the develop (Packagist dev-master) version of WPCS as it contains lots of bugfixes.
  • Remove the PHPCS dependency. This is a dependency of WPCS, not of WP Core itself. This will also make sure that the PHPCS version used is always one which is supported by WPCS.
  • Refreshed the composer.lock file.

PHPCS ruleset:

  • Comment out a reference to a sniff which doesn't exist in WPCS yet (for now).
  • Use the PHPCS 3.x basepath option to clean up the file paths PHPCS shows in the reports.
  • Use the PHPCS 3.x parallel option to enable parallel scanning whenever possible to speed up the scans.
  • Whitelist the wp-includes/I18n.php file from issues being reported by the WordPress.WP.I18n sniff.

Attachments (2)

44366.patch (6.2 KB) - added by jrf 6 years ago.
44366-50branch.diff (14.0 KB) - added by netweb 6 years ago.

Download all attachments as: .zip

Change History (12)

@jrf
6 years ago

#1 @jrf
6 years ago

  • Owner set to jrf
  • Resolution set to fixed
  • Status changed from new to closed

In 43348:

Build/Tools: Update PHPCS ruleset for WP Core and related Composer setup.

.gitignore + svn:ignore:

  • Add the typical filenames of overloaded PHPCS configs to .gitignore.

Composer:

  • Use the develop (Packagist dev-master) version of WPCS as it contains lots of bugfixes.
  • Remove the PHPCS dependency. This is a dependency of WPCS, not of WP Core itself. This will also make sure that the PHPCS version used is always one which is supported by WPCS.
  • Refreshed the composer.lock file.

PHPCS ruleset:

  • Removed a reference to a sniff which doesn't exist in WPCS yet.
  • Use the PHPCS 3.x basepath option to clean up the file paths PHPCS shows in the reports.
  • Use the PHPCS 3.x parallel option to enable parallel scanning whenever possible to speed up the scans.
  • Whitelist the wp-includes/l10n.php file from issues being reported by the WordPress.WP.I18n sniff.

Fixes #44366.

#2 @jrf
6 years ago

  • Component changed from General to Build/Test Tools
  • Milestone changed from Awaiting Review to 5.0

#3 @GaryJ
6 years ago

Use the develop (Packagist dev-master) version of WPCS as it contains lots of bugfixes.

The composer.lock is showing that this is now pointing to https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/commit/cf6b310caad735816caef7573295f8a534374706 which is the 0.14.1 release.

Was this intended, or should it have been the dev-develop branch (https://packagist.org/packages/wp-coding-standards/wpcs#dev-develop)?

#4 @GaryJ
6 years ago

Also, there appears to be a typo: "simultanously" should be "simultaneously"

#5 @jorbin
6 years ago

  • Milestone changed from 5.0 to 5.1

#6 @netweb
6 years ago

  • Milestone changed from 5.1 to 5.0
  • Resolution fixed deleted
  • Status changed from closed to reopened

As part of adding PHPCS to the 5.0 branch reopening and moving back to the 5.0 milestone

#7 @netweb
6 years ago

  • Keywords commit added

Patch 44366-50branch.diff for the 5.0 branch is ready for commit

Note: The patch includes the changes for svn:ignore, highly unlikely it will applied when applying the patch though.

To edit svn:ignore run svn propedit svn:ignore . from the command line and add phpcs.xml and .phpcs.xml after phpunit.xml

Index: .
===================================================================
--- .   (revision 43735)
+++ .   (working copy)

Property changes on: .
___________________________________________________________________
Modified: svn:ignore
## -5,9 +5,11 ##

 # Files and folders related to build/test tools
 phpunit.xml
+phpcs.xml
+.phpcs.xml
 node_modules
 npm-debug.log
 build
 wp-cli.local.yml
 .git
 jsdoc

#8 @netweb
6 years ago

Patch 44366-50branch.diff is based on [43348] for backporting to the 5.0 branch

It also includes recent phpcs.xml.dist changes from:

It also includes recent composer.json/composer-lock.json changes from:

I've not re-opened the above 6 tickets for the 5.0 milestone, committers choice to reference these during commit

Last edited 6 years ago by netweb (previous) (diff)

#9 @pento
6 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 43786:

Build/Tools: Add PHPCS to the 5.0 branch.

This allows us to apply WordPress Coding Standards rules to new files in the 5.0 branch.

Props netweb.
Fixes #44366.

#10 @ocean90
6 years ago

In 44507:

Build/Tools: Fix typo in phpcs.xml.dist.

See #44366.

Note: See TracTickets for help on using tickets.