Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--
Thanks for taking the time to submit a Pull Request.
-->

## What
<!-- In a few words, what does this PR actually change -->

## Why
<!-- Why is this PR necessary? Please any existing previous issue(s) or PR(s) and include a short summary here, too -->

## How
<!-- How is your PR addressing the issue at hand? What are the implementation details? -->

## Testing Instructions
<!-- Please include step by step instructions on how to test this PR. Ideally with a code example. -->

## Checklist:
<!-- We encourage you to complete this checklist to the best of your abilities. If you can't do everything, that's okay too. -->
- [ ] My code is tested to the best of my abilities.
- [ ] I included the relevant changes in CHANGELOG.md
3 changes: 3 additions & 0 deletions .github/funding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: [AxeWp]
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.vscode/
build/
vendor/
composer.lock
Expand Down
21 changes: 19 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,27 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a

## [ Unreleased ]

## [ 2.0.1 ] - 2025-05-03

This release fixes several bugs where rules were not being disabled correctly.

We've also added CI to the repo to test the rulesets against the latest WPGraphQL codebase, to preemptively catch future issues.

### WPGraphQL-Core

- fix: Fix incorrect excludes XML block in `WPGraphQL-Core` ruleset.

### WPGraphQL-Docs

- fix: Disable `Squiz.Commenting.VariableComment.MissingVar` in favor of `SlevomatCodingStandard.TypeHints.PropertyTypeHint`.

### WPGraphQL-Minimum
- fix: Ignore `SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation` for PHPStan annotations.
- fix: Fix incorrect excludes in `WPGraphQL-Core` ruleset.
- ci: Add ruleset testing Workflow.

### Misc

- ci: Add test workflow.
- docs: cleanup Readme.

## [2.0.0] - 2025-02-15

Expand Down
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# WPGraphQL Coding Standards for [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer)
# WPGraphQL Coding Standards for PHP_CodeSniffer

This project is a collection of rules and sniffs for PHPCS to validate code developed for the [WPGraphQL](https://github.com/wp-graphql/wp-graphql) ecosystem. It uses rules from:
![Packagist License](https://img.shields.io/packagist/l/axepress/wp-graphql-cs?color=green) ![Packagist Downloads](https://img.shields.io/packagist/dt/axepress/wp-graphql-cs) ![Packagist Version](https://img.shields.io/packagist/v/axepress/wp-graphql-cs?label=stable) ![GitHub commits since latest release (by SemVer)](https://img.shields.io/github/commits-since/AxeWP/WPGraphQL-Coding-Standards/2.0.1) ![GitHub Repo stars](https://img.shields.io/github/stars/AxeWP/WPGraphQL-Coding-Standards?style=social) ![Tests](https://img.shields.io/github/actions/workflow/status/axewp/WPGraphQL-Coding-Standards/test.yml?branch=develop&label=CI)

-----
This project is a collection of rules and sniffs for [PHPCS](https://github.com/squizlabs/PHP_CodeSniffer) to validate code developed for the [WPGraphQL](https://github.com/wp-graphql/wp-graphql) ecosystem. It uses rules from:
- [WordPress Coding Standards](https://github.com/WordPress/WordPress-Coding-Standards)
- [Automattic VIP Coding Standards](https://github.com/Automattic/VIP-Coding-Standards)
- [Slevomat Coding Standard](https://https://github.com/slevomat/coding-standard)
Expand Down Expand Up @@ -55,3 +58,13 @@ In this file, you will want to configure the following:
- [`minimum_wp_version`](./phpcs.xml.dist.example#L43) - The minimum WordPress version you want to test against. This should be the lowest version of WordPress that you want to support. While WPGraphQL officially supports WordPress 5.0+, we recommend testing against WordPress 5.6 (the current lowest version actively [tested against](https://github.com/wp-graphql/wp-graphql/blob/develop/.github/workflows/testing-integration.yml)) or higher.
- [`WordPress.WP.I18n.text_domain`](./phpcs.xml.dist.example#L63) - The text domain used in your project. This is used by the `WordPress.WP.I18n` sniff to check that all translatable strings are assigned to a text domain. We recommend using the format `wp-graphql-<project-name>`.
- [`WordPress.NamingConventions.PrefixAllGlobals`](./phpcs.xml.dist.example#L57) - The list of prefixes used in your project. This is used by the `WordPress.NamingConventions.PrefixAllGlobals` sniff to check that all global functions, classes, constants, and variables are prefixed.

## Development and Support

The project is actively maintained by [AxePress Development](https://axepress.dev). Community contributions are _welcome_ and **encouraged**.

Basic support is provided for free, both in [this repo](https://github.com/AxeWP/WPGraphQL-Coding-Standards/issues) and in [WPGraphQL's official Discord](https://discord.gg/55h7WmYZff).

Priority support and custom development are available to [our Sponsors](https://github.com/sponsors/AxeWP).

<a href="https://github.com/sponsors/AxeWP" alt="GitHub Sponsors"><img src="https://img.shields.io/static/v1?label=Sponsor%20Us%20%40%20AxeWP&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86&style=for-the-badge" /></a>
2 changes: 1 addition & 1 deletion WPGraphQL/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WPGraphQL Strict Coding Standard" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
<description>WPGraphQL Coding Standards</description>

<!-- Includes WPGrapQL-Minimum and WPGraphQL-Strict-->
<!-- Includes WPGraphQL-Minimum and WPGraphQL-Strict-->
<rule ref="WPGraphQL-Extra" />
<rule ref="WPGraphQL-Docs" />

Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml.dist.example
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
Tests for WordPress version compatibility.
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties
-->
<config name="minimum_wp_version" value="5.9"/>
<config name="minimum_wp_version" value="6.0"/>

<!-- Rules: WPGraphQL Coding Standards -->
<!-- https://github.com/AxeWP/WPGraphQL-Coding-Standards/WPGraphQL/ruleset.xml -->
Expand Down