Skip to content

Rulesets: update schema URL #2529

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

Merged
merged 1 commit into from
May 22, 2025
Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented May 19, 2025

PHPCS now offers permalinks for the schema.

Refs:
* PHPCSStandards/PHP_CodeSniffer 1094
* https://github.com/PHPCSStandards/schema.phpcodesniffer.com
@GaryJones
Copy link
Member

Should the schema URL be versioned?

@jrfnl
Copy link
Member Author

jrfnl commented May 20, 2025

Should the schema URL be versioned?

That depends. There are permalinks available for each (minor) PHPCS version which includes the phpcs.xsd file, i.e. PHPCS 3.2 and higher. And then there is the permalink for the "current"/latest version, which is what I've used now.

Now, even though the minors each have there own permalink, the phpcs.xsd file hasn't changed that often. If you look at the file history, you will see that the file:

  • Was introduced in PHPCS 3.2.0.
  • Was updated for the new array property syntax in 3.3.2 (even though the array syntax was introduced in 3.3.0).
  • Was updated for extending array properties in 3.4.0.
  • Was fixed for an oversight (missing support for phpcs-only and phpcbf-only) in 3.5.0.
  • ... and hasn't changed since.

Now, we could use the permalink for the 3.9 version to align with the current minimum supported PHPCS version of WPCS, but, as per the above, there is no difference between the "current" (3.13) version and the 3.9 version.
And if we'd do that, it would also require for us to keep that version number updated whenever we update the minimum PHPCS version, which is error-prone.

In my opinion, it only makes sense to use a versioned permalink if PHPCS adds support for a new ruleset feature and WPCS doesn't use this ruleset feature (yet) as the minimum supported PHPCS version is too low.
In that case, we should set the permalink to a versioned one before the upstream change - i.e. to the version which aligns with our minimum supported PHPCS version.

However, that doesn't currently apply and the phpcs.xsd file doesn't change that often (unlike the PHPUnit one), which is why I've pulled this with the permalink to the "latest" phpcs.xsd file.

@GaryJones Does that answer your question ?

@GaryJones
Copy link
Member

In that case, we should set the permalink to a versioned one before the upstream change - i.e. to the version which aligns with our minimum supported PHPCS version.

That's the manual task I'd be minorly concerned about (though, I know you will remember!).

@GaryJones GaryJones merged commit 16b9992 into develop May 22, 2025
50 checks passed
@GaryJones GaryJones deleted the feature/update-phpcs-xsd-schema-url branch May 22, 2025 06:15
@jrfnl
Copy link
Member Author

jrfnl commented May 28, 2025

That's the manual task I'd be minorly concerned about (though, I know you will remember!).

And if I don't, I'm sure you'll remind me 😜

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

Successfully merging this pull request may close these issues.

3 participants