Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WordPress CS 3.0.0 planning & roadmap #1877

Closed
16 of 19 tasks
jrfnl opened this issue Apr 1, 2020 · 35 comments
Closed
16 of 19 tasks

WordPress CS 3.0.0 planning & roadmap #1877

jrfnl opened this issue Apr 1, 2020 · 35 comments
Milestone

Comments

@jrfnl
Copy link
Member

jrfnl commented Apr 1, 2020

Work on WordPressCS 3.0.0 will start in the near future. @GaryJones, @dingo-d and me have recently had a call to discuss what we envision for WPCS 3.0.0.

This issue is intended to keep track of what needs to be done, as well as give openness about the changes envisioned for WPCS 3.0.0.

Milestone: https://github.com/WordPress/WordPress-Coding-Standards/milestone/25

Planning:

  • Ready when it's ready.
  • Most of the initial PRs are tentatively expected in the second half of April/beginning of May (2020) July 2020.
  • There will be at least one release candidate before the actual release of WPCS 3.0.0.

Environment changes:

  • The minimum PHPCS requirement will go up to - at least - PHPCS 3.5.0.
  • WPCS will get two (three) new dependencies:
  • The installation instructions will change.
    • A Composer based project/global install will be the recommended and only supported manner of installation.
    • Stand-alone installation from a downloaded zip file, using a git clone or using composer create-project will still be possible, but no support will be given for those installations.

Note: PHPCSUtils and PHPCSExtra both are on 1.0.0-alphaX releases at the time of writing this.
The first stable 1.0.0 for both will be tagged before the first WPCS 3.0.0 RC will be (pre-)released.

Roadmap / what needs to be done:

I've tried to be complete here, but please feel free to leave comments about anything I've forgotten in this list ;-)

@jrfnl jrfnl added this to the 3.0.0 milestone Apr 1, 2020
@jrfnl jrfnl pinned this issue Apr 1, 2020
@jrfnl
Copy link
Member Author

jrfnl commented Apr 1, 2020

Oh and just in case anyone is wondering about the date: no this amount of work is no joke 😂

@jrfnl
Copy link
Member Author

jrfnl commented Jul 9, 2020

Status of sniff review & priorities:

To review - prio 1:

All done

To review - prio 2:

Code in the sniff (if any) itself can be reviewed already. Underlying abstract sniff logic is expected to be replaced with an abstract from PHPCSUtils.

All done

To review - prio 3:

All done

Leave alone for now as these will probably be (partially) replaced with a sniff from PHPCSExtra:

  • WordPress.Classes.ClassInstantiation (removed)
  • WordPress.WhiteSpace.PrecisionAlignment (removed)

Reviewed & changes pulled:

Verified / No (extra) changes needed:

  • WordPress.DateTime.RestrictedFunctions (@jrfnl)
    Note: the underlying abstract for this sniff is still subject to change.
  • WordPress.DB.RestrictedClasses (@jrfnl)
    Note: the underlying abstract for this sniff is still subject to change.
  • WordPress.DB.RestrictedFunctions (@jrfnl)
    Note: the underlying abstract for this sniff is still subject to change.
  • WordPress.DB.SlowDBQuery (@jrfnl)
    Note: the underlying abstract for this sniff is still subject to change.
  • WordPress.PHP.DevelopmentFunctions (@jrfnl)
    Note: the underlying abstract for this sniff is still subject to change.
  • WordPress.PHP.DiscouragedPHPFunctions (@jrfnl)
    Note: the underlying abstract for this sniff is still subject to change.
  • WordPress.PHP.DontExtract (@jrfnl)
    Note: this sniff will probably be replaced by one from Extra.
  • WordPress.PHP.POSIXFunctions (@jrfnl)
    Note: the underlying abstract for this sniff is still subject to change.
  • WordPress.PHP.RestrictedPHPFunctions (@jrfnl)
    Note: the underlying abstract for this sniff is still subject to change.
  • WordPress.PHP.TypeCasts (@jrfnl)
  • WordPress.Security.SafeRedirect (@jrfnl)
    Note: the underlying abstract for this sniff is still subject to change.
  • WordPress.WP.DeprecatedClasses (@jrfnl)
    Note: the underlying abstract for this sniff is still subject to change.
  • WordPress.WP.DiscouragedFunctions (@jrfnl)
    Note: the underlying abstract for this sniff is still subject to change.
  • WordPress.WP.PostsPerPage (@jrfnl)
    Note: the underlying abstract for this sniff is still subject to change.

Please add your name to the sniff to claim it or leave a comment in this thread.

@shivapoudel
Copy link

@jrfnl Deal direct is not supported for PHP 8.0, will that be patched in WPCS 3.0.0?

@jrfnl
Copy link
Member Author

jrfnl commented Jun 13, 2021

@shivapoudel The DealerDirect plugin is a dev dependency in WPCS 2.x, so should not be a concern of an end-user (other than that they should probably require-dev it in their own project).
As of WPCS 3.x, it will be a no-dev dependency via the PHPCSUtils library and will allow for a wide range of versions.

@GaryJones
Copy link
Member

GaryJones commented Jun 13, 2021

@shivapoudel
Copy link

shivapoudel commented Jun 13, 2021

@jrfnl @GaryJones This is the error I am receiving currently with PHP 8.0.

$ composer create-project wp-coding-standards/wpcs --no-dev
Creating a "wp-coding-standards/wpcs" project at "./wpcs"
Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/
Installing wp-coding-standards/wpcs (2.3.0)
  - Installing wp-coding-standards/wpcs (2.3.0): Loading from cache
Created project in C:\Users\shiva\wpcs
Loading composer repositories with package information
Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - dealerdirect/phpcodesniffer-composer-installer v0.6.2 requires php ^5.3|^7 -> your PHP version (8.0.0) does not satisfy that requirement.
    - dealerdirect/phpcodesniffer-composer-installer v0.6.1 requires php ^5.3|^7 -> your PHP version (8.0.0) does not satisfy that requirement.
    - dealerdirect/phpcodesniffer-composer-installer v0.6.0 requires php ^5.3|^7 -> your PHP version (8.0.0) does not satisfy that requirement.
    - dealerdirect/phpcodesniffer-composer-installer v0.5.0 requires php ^5.3|^7 -> your PHP version (8.0.0) does not satisfy that requirement.
    - Installation request for dealerdirect/phpcodesniffer-composer-installer ^0.5 || ^0.6 -> satisfiable by dealerdirect/phpcodesniffer-composer-installer[v0.5.0, v0.6.0, v0.6.1, v0.6.2].

Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.

Now lets see if everything is compatible with latest stable composer. I am giving it a try:

$ composer self-update --2
Updating to version 2.1.3 (2.x channel).
   Downloading (100%)
Use composer self-update --rollback to return to version 1.10.22

Again receiving some sort of dealerdirect problems:

$ composer create-project wp-coding-standards/wpcs --no-dev
Creating a "wp-coding-standards/wpcs" project at "./wpcs"
Installing wp-coding-standards/wpcs (2.3.0)
  - Installing wp-coding-standards/wpcs (2.3.0): Extracting archive
Created project in C:\Users\shiva\wpcs
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - dealerdirect/phpcodesniffer-composer-installer[v0.5.0, ..., v0.6.2] require php ^5.3|^7 -> your php version (8.0.0) does not satisfy that requirement.
    - Root composer.json requires dealerdirect/phpcodesniffer-composer-installer ^0.5 || ^0.6 -> satisfiable by dealerdirect/phpcodesniffer-composer-installer[v0.5.0, v0.6.0, v0.6.1, v0.6.2].

Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.

@jrfnl
Copy link
Member Author

jrfnl commented Apr 15, 2022

@dingo-d and me had a long call today discussing how to move forward and get WPCS 3.0.0 in a releasable state.

Aside from everything discussed above (and overlapping it), we came to the conclusion that there are four big things which need to be addressed and we intend to take action on these in the near future:

  1. Implement all non-disputed rules from the March 2020 Make post, in as far as there are ready-made sniffs available for it already.
    Everything that still needs a new sniff to be written for it, can be actioned in later 3.x versions.
  2. Implement PHPCSUtils anywhere and everywhere.
  3. Add support to all sniffs for PHP 7.4, 8.0 and 8.1 syntaxes, in so far they are currently supported by PHPCS itself.
    This also means preventing false positives/negatives related to those new syntaxes.
    We strongly recommend updating the minimum supported PHPCS version to 3.7.0 as soon as it is released, which should be before WPCS 3.0.0 is ready for its new release. This will prevent a lot of issues and having to introduce work-arounds for new syntaxes.
  4. Move generic utilities which are NOT moving to PHPCSUtils to traits to allow us to switch the abstract sniff used by sniffs in the future without that being a breaking change.

Of course, other generic maintenance actions, like updating the global variables list, updating deprecated function lists etc should all be executed as well before release.

@jrfnl
Copy link
Member Author

jrfnl commented Aug 12, 2022

FYI: @dingo-d and me are working our way through the March 2020 Make post to add all rules which didn't gather any relevant discussion to the Handbook + to add sniffs for these new rules, in as far as sniffs for them are currently available.

We tracking our progress on this here: https://docs.google.com/spreadsheets/d/1ZsjWtacz3jNIL-splQFuZLwjkVJYavpqwMVKCAzlgQk/edit?usp=sharing

@kkmuffme
Copy link

Quick question: are https://make.wordpress.org/core/2020/03/20/updating-the-coding-standards-for-modern-php/ added to WPCS 3.0.0 already?
e.g.

  • declare( should not have spaces inside
  • the file doc should be above any namespace/declare/use statements
  • no space before ::class
    ...

@dingo-d
Copy link
Member

dingo-d commented Jan 25, 2023

Yes, partially. Some proposals had comments that will be addressed in the subsequent make posts. You can check the sheet with the parts that will go into the WPCS and parts that won't on this comment.

@kkmuffme
Copy link

Could you perhaps check that you correctly handle this case:

<?php

use Foo\Bar;

/**
 * bla
 */
use Abc\Xyz;

As slevomat currently has a bug slevomat/coding-standard#1504 and I guess there will be a similar issue here.

@dingo-d
Copy link
Member

dingo-d commented Jan 25, 2023

What do you expect to happen for the above example? It's hard to check without info about what is the desired behavior 🤷🏼‍♂️

Please open a new issue to discuss this specific issue further.

@kkmuffme
Copy link

See the slevomat issue.
I expect all "use" statements to be grouped togeteher correctly after the file doc

@dingo-d
Copy link
Member

dingo-d commented Jan 26, 2023

Did you try using develop branch of WPCS and see if the import use statements part would cover what you asked?

https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#declare-statements-namespace-and-import-statements

@jrfnl
Copy link
Member Author

jrfnl commented Jan 26, 2023

@dingo-d IIRC the rules related to import use statements will be added before the 3.0.0 release in as far as they are currently available, but they haven't yet been added (see the spreadsheet).

@szepeviktor
Copy link
Contributor

Hello @jrfnl! 👋🏻
I've just read that Neutron was abandoned. What are the effects of that to WPCS?

@jrfnl
Copy link
Member Author

jrfnl commented Feb 26, 2023

Hello @jrfnl! 👋🏻 I've just read that Neutron was abandoned. What are the effects of that to WPCS?

@szepeviktor I don't understand why you are asking. I've vaguely heard of Neutron, but I don't see any relationship to WPCS ? I.e. Kudos to the maintainers about being clear they are abandoning a package. Nothing to do with WPCS though.

@szepeviktor

This comment was marked as off-topic.

@jrfnl

This comment was marked as off-topic.

@jrfnl
Copy link
Member Author

jrfnl commented Feb 26, 2023

@szepeviktor As a side-note: this discussion doesn't belong in this issue.

@nickpelton

This comment was marked as off-topic.

@jrfnl

This comment was marked as off-topic.

@szepeviktor

This comment was marked as off-topic.

@jrfnl

This comment was marked as off-topic.

@szepeviktor

This comment was marked as off-topic.

@jrfnl

This comment was marked as off-topic.

@nickpelton

This comment was marked as off-topic.

@jrfnl
Copy link
Member Author

jrfnl commented Jul 28, 2023

I found references to this ticket as the plan

This is a plan for WordPressCS, not for WP Core.

Then I saw the question about PHP5.6 support, and the reply. So I assumed it was on topic

You clearly missed the next comment (just above your comment....)

As a side-note: this discussion doesn't belong in this issue.

Which reopens that questions of adopting PHP7 standards.

No, it does not.

This ticket is the roadmap for WordPressCS 3.0.0. If you want to propose things for WordPressCS, create a new ticket (if one doesn't exist for the same already). If a proposal could be considered for Core, it will need approval via a proposal on Make.

However, if you want to propose for WP Core to start using certain PHP 7 features (which I suspect is what you actually want), you are in the wrong repo. Go and open a ticket in Trac.

Whether or not WP Core decides to use PHP 7 features is completely unrelated to the Coding Standards and should NOT be discussed in this repo.

If WP Core does decide to use certain things, then it can be discussed here if certain coding standards should be enforced for whatever PHP 7 syntax we're talking about (if they aren't already), but that's a completely different issue and different decision and neither of these topics have anything to do with the Roadmap for WPCS 3.0.0, which is closed and not open for new proposals as we're very close to the release.

@meshakeeb

This comment was marked as spam.

@BWBama85

This comment was marked as abuse.

@meshakeeb
Copy link

When we are seeing this released Its been 3 years

This is a serious question not a spam. Why made such a huge roadmap where we can divide the project into smaller iterations.

@jrfnl
Copy link
Member Author

jrfnl commented Aug 10, 2023

@meshakeeb Asked & answered multiple times before. You clearly have no idea of the work involved. I get the impatience, but unless you have something positive to contribute to the conversation, you are just putting more stress on already overloaded maintainers.

@meshakeeb
Copy link

Sorry if you feel that way @jrfnl. How can I contribute?

@jrfnl
Copy link
Member Author

jrfnl commented Aug 15, 2023

@meshakeeb Thanks. For the 3.0.0 release, there is not much anyone else can do anymore, we're nearly done, though testing the develop branch against your own codebases would still help. If you find any unexpected issues, please let us know.

Having said that, contributions are always welcome, whether they are for the 3.0.0 release or future releases.
Issue labeled with Good first issue, Help wanted or Needs investigation are good starting points.

@jrfnl jrfnl mentioned this issue Aug 20, 2023
36 tasks
@jrfnl jrfnl closed this as completed Aug 21, 2023
@jrfnl jrfnl unpinned this issue Aug 21, 2023
@meshakeeb
Copy link

Hello WPCS team, heartily congratulations on the big release. I will update my projects on this and if find any issue will report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants