Commit graph

20 commits

Author SHA1 Message Date
jrfnl
cd0d82a327
Rulesets: update schema URL
PHPCS now offers permalinks for the schema.

Refs:
* PHPCSStandards/PHP_CodeSniffer 1094
* https://github.com/PHPCSStandards/schema.phpcodesniffer.com
2025-05-19 18:23:15 +02:00
Viktor Szépe
dfd6c3a8ee
Fix typos (#2472) 2024-08-07 12:30:25 +02:00
jrfnl
15e1fc94f5
Switch to PHPCSStandards/PHP_CodeSniffer
The Squizlabs repo has been abandoned. The project continues in a fork in the PHPCSStandards organisation.

Ref:
* squizlabs/PHP_CodeSniffer 3932
2023-12-10 14:06:51 +01:00
Dawid Urbański
387784c8a0 Docs: Use WordPress.Files.FileName rule instead of WordPress.Files.Filename in the sample phpcs ruleset 2023-09-03 10:43:53 +02:00
jrfnl
9c23de677f
Docs: update the sample ruleset
* Replace an example of a rule exclusion as excluding security sniffs should be encouraged.
* Remove an example of an "extra rule" as that sniff is now included in WPCS.
* Minor tweak to the example of how to include PHPCompatibilityWP.
    Note: I've raised the minimum PHP version to 5.6, not yet to 7.0 as plugins/themes (which are the typical target public for this example ruleset) often support multiple WP versions.
* Update property name.
* Give a few examples of legitimate selective directory excludes.
2023-08-15 15:23:27 +02:00
jrfnl
b996338a60
Sample ruleset: add a few more common directives 2022-12-04 18:06:48 +01:00
jrfnl
79dfeadc4a
PHPCS ruleset: divide the ruleset into "chapters"
... and improve the documentation.

Applies the same "chapter" headings in the `phpcs.xml.dist.sample` file.
2022-12-04 18:04:43 +01:00
Denis Žoljom
fab1ed525e Documentation: Update all links to the repository (#1748)
The GitHub repository has moved from the dedicated `WordPress-Coding-Standards` organisation to the `WordPress` organisation.

This:
* Updates all links which pointed to the old repo on GH to the new one.
* Updates the badges in the Readme to pick up things up correctly again for the new repo.
* Updated all links to Travis from `.org` to `.com` as the build CI has moved as well.
2019-07-01 05:33:31 +02:00
jrfnl
3aadeeea8b Update default minimum_supported_version to WP 4.9
The minimum version should be three versions behind the latest WP release, so what with 5.2 being out, it should now be 4.9.

Includes (not) updating the list of deprecated functions. Input for this based on @JDGrimes's WP deprecated code scanner.
2019-05-18 17:18:03 +02:00
jrfnl
34920c722d Update default minimum_supported_version to WP 4.8
The minimum version should be three versions behind the latest WP release, so what with 5.1 being out, it should now be 4.8.

Includes updating the list of deprecated functions. Input for this based on @JDGrimes's WP deprecated code scanner.
2019-03-31 14:16:11 +02:00
Gary Jones
c130cfd854
Merge pull request #1564 from WordPress-Coding-Standards/feature/ruleset-validate-against-xsd
Build/Rulesets: Add XSD schema tags and validate rulesets against schema (PHPCS 3.2+/3.3.2+)
2018-12-19 17:20:32 +00:00
jrfnl
71aed7ae23 Rulesets: Add XSD schema tags and validate rulesets against schema (PHPCS 3.2+/3.3.2+)
As of PHPCS 3.2.0, PHPCS includes an XSD schema for rulesets which defines what can be used in the XML ruleset file.

In PHPCS 3.3.0 a new array format for properties was introduced and as of PHPCS 3.3.2, the new array format is now also covered by this schema.

This commit:
* Adds the schema tags to the `ruleset.xml` files, the WPCS native `.phpcs.xml.dist` file, as well as to the example ruleset.
* Adds validation against the schema for the `ruleset.xml` files and the example ruleset to the Travis build.

Note:
The schema used in the tags points to the online schema in PHPCS `master` for two reasons:
1. While WPCS now has a minimum requirement of PHPCS 3.3.1, the schema in PHPCS `master` contains the changes which were made in PHPCS 3.3.2, so we can safely validate the rulesets against the schema.
2. While installation via Composer is supported for WPCS, it is **not** the _only_ supported installation method, so pointing to the version of the XSD schema in the `vendor` directory would be presumptuous.

At the same time, using the URL in the Travis script appears to be problematic and as we're doing a composer install there anyway, we may as well use the version in the `vendor` directory for the actual validation.
As the validation is done on a build with PHPCS `master`, there will be no difference anyway.

Fixes 1477
2018-12-19 15:26:25 +01:00
jrfnl
efce48ae5a Rulesets: Start using the new XML array format (PHPCS 3.3+)
A new format for passing array elements to PHPCS properties was added in PHPCS 3.3.0.
This new array format is far more readable and less error prone than the old format.

This commit implements using this new array format throughout WPCS, wherever relevant, including in property setting examples in the documentation.

Ref:
* squizlabs/PHP_CodeSniffer 1665
2018-12-19 15:25:55 +01:00
jrfnl
6df379d6ec Update default minimum_supported_version to WP 4.7
The minimum version should be three versions behind the latest WP release, so what with 5.0 having come out last week, it should now be 4.7.
2018-12-15 13:33:19 +01:00
jrfnl
b2e9f984b2 Update for PHPCompatibility 9.0.0
[PHPCompatibility 9.0.0](https://github.com/PHPCompatibility/PHPCompatibility/releases/tag/9.0.0) has just been released and renames all sniffs.

* Updated the version restrictions in `composer.json`.
    As the sniff names have changed, set minimum version.
    Note: PHPCompatibility 9.0.0 is still compatible with PHPCS 2.3.0 up to current, so this doesn't make a difference for running the sniffs.
* Updated the WPCS native PHPCS ruleset for the new PHPCompatibility sniff codes.
* Updated the inline annotations for the new PHPCompatibility sniff codes.
* Updated the `phpcs.xml.dist.sample` to favour the `PHPCompatibilityWP` ruleset (was missed in PR 1426).
* Updated a few more links to the PHPCompatibility repo for the move to an organisation (which were missed in PR 1426).
2018-10-08 02:03:39 +02:00
jrfnl
7eed80dd3f Example ruleset: update for WPCS 1.0.0 and PHPCompatibility best practices
Also includes a minor change in the Readme test pertaining to the same PHPCompatibility `testVersion` advice.
2018-06-28 12:31:40 +02:00
jrfnl
bd98f6728e Update minimum supported WP version
The minimum version should be three versions behind the latest WP release, so what with 4.9 having come out last week, it should now be 4.6.
2017-11-24 00:11:09 +01:00
jrfnl
eada7ac810 Update example ruleset for new minimum_supported_wp_version config variable
Related to 1094
2017-09-23 14:20:42 +02:00
jrfnl
3c05a1326c Update example ruleset based on feedback
Issue 1128 raised the interesting point that example exclusions maybe taken over literally by people who are not as familiar with PHPCS.

This minor change should prevent that.
2017-09-09 00:54:17 +02:00
Gary Jones
c7e3426cac Rename project.ruleset.xml.example to phpcs.xml.dist.sample
See #1028
2017-07-14 12:20:31 +01:00
Renamed from project.ruleset.xml.example (Browse further)