Skip to content

Commit b2973c1

Browse files
authored
Merge pull request #2 from justlevine/release/1.0.0-beta.4
release: v1.0.0-beta.4
2 parents 365a066 + ed77539 commit b2973c1

File tree

5 files changed

+69
-53
lines changed

5 files changed

+69
-53
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a
66

77
## [Unreleased]
88

9+
## [1.0.0-beta.4] - 2023-08-17
10+
- feat!: Updated `WPGraphQL-Minimum` and `WPGraphQL-Strict` based on the latest changes to WPGraphQL core. (See https://github.com/wp-graphql/wp-graphql/compare/release/v1.14.10...develop#diff-05ae9cddcaec1e845771a7db224961439f83ef5939ec67d3a48744cb34d7e58b)
11+
- feat: Add `WPGraphQL-Core` coding standard, for a snapshot of what's currently being used upstream.
12+
913
## [1.0.0-beta.3] - 2023-08-04
1014
- feat!: Move `WordPress.WP.I18n.MissingTranslatorsComment` from `WPGraphQL-Strict` to `WPGraphQL-Minimum`. (Added to WPGraphQL in https://github.com/wp-graphql/wp-graphql/pull/2856)
1115
- feat!: Move `SlevomatCodingStandard.Functions.StaticClosure` from `WPGraphQL-Strict` to `WPGraphQL-Minimum`. (Added to WPGraphQL in https://github.com/wp-graphql/wp-graphql/pull/2855)

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ The project provides a superset of sniffs that the WPGraphQL community may need.
2323
You can use the following standard names when invoking `phpcs` to select the sniffs you want to use.
2424

2525
* [`WPGraphQL`](./WPGraphQL/ruleset.xml) - complete set with all of the sniffs in the project.
26-
- [`WPGraphQL-Minimum`](./WPGraphQL-Minimum/ruleset.xml): basic ruleset for WPGraphQL projects, including all the sniffs used by the WPGraphQL plugin itself.
26+
- [`WPGraphQL-Minimum`](./WPGraphQL-Minimum/ruleset.xml): basic ruleset for WPGraphQL projects.
2727
- [`WPGraphQL-Strict`](./WPGraphQL-Strict/ruleset.xml): includes all the sniffs in the `WPGraphQL-Minimum` ruleset, plus additional functional sniffs to help you produce enterprise-ready code.
28+
- [`WPGraphQL-Core`](./WPGraphQL-Core/ruleset.xml): includes all the sniffs currently used by the WPGraphQL core project. Currently is the same as the `WPGraphQL-Strict` ruleset, with a few sniffs disabled.
2829
- [`WPGraphQL-Extra`](./WPGraphQL-Extra/ruleset.xml): includes all the sniffs in the `WPGraphQL-Strict` ruleset, plus additional formatting sniffs to keep your code looks consistent across your project.
2930
- [`WPGraphQL-Docs`](./WPGraphQL-Docs/ruleset.xml): includes sniffs for doc-blocks and inline comments.
3031

WPGraphQL-Core/ruleset.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0"?>
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WPGraphQL Core Coding Standard" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
3+
<description>Coding Standards used by the WPGraphQL core plugin.</description>
4+
5+
<!-- The rules below are the changes from between the original sniff or parent ruleset, and what should be applied for this Standard. -->
6+
7+
<!-- Load WordPress Coding standards -->
8+
<rule ref="WPGraphQL-Strict" >
9+
<!-- This would be a breaking change to fix in Core -->
10+
<exclude name="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid"/>
11+
<!-- Conflicts with b/c in AbstractConnectionResolver -->
12+
<exclude name="Squiz.Commenting.FunctionComment.InvalidNoReturn" />
13+
</rule>
14+
15+
</ruleset>

WPGraphQL-Minimum/ruleset.xml

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,30 @@
88
<include-pattern>*\.php$</include-pattern>
99
</rule>
1010

11-
<!-- Load WordPress VIP Go standards - for use with projects on the (newer) VIP Go platform. -->
11+
<!--
12+
Load WordPress VIP Go standards
13+
see: https://docs.wpvip.com/technical-references/vip-code-analysis-bot/phpcs-report/
14+
-->
1215
<rule ref="WordPress-VIP-Go" />
1316

14-
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction"/>
15-
16-
<rule ref="WordPress-Core">
17+
<rule ref="WordPress">
18+
<!-- Definitely should not be added back -->
1719
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
20+
<exclude name="WordPress.CodeAnalysis.AssignmentInCondition.Found"/>
21+
<exclude name="WordPress.Files.FileName"/>
22+
<exclude name="WordPress.NamingConventions.ValidVariableName"/>
23+
<exclude name="WordPress.PHP.DisallowShortTernary.Found"/>
1824

1925
<!-- Should probably not be added back -->
2026
<exclude name="PHPCompatibility.Keywords.ForbiddenNamesAsDeclared.objectFound"/>
27+
<exclude name="WordPress.NamingConventions.ValidHookName.UseUnderscores"/>
2128

2229
<!-- Added back in WPGraphQL-Strict -->
23-
<exclude name="Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure"/>
24-
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket"/>
2530
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine"/>
31+
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket"/>
2632
<exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments"/>
27-
</rule>
28-
29-
<!-- Load WordPress Coding standards -->
30-
<rule ref="WordPress">
31-
<exclude name="WordPress.NamingConventions.ValidVariableName"/>
32-
<exclude name="WordPress.NamingConventions.ValidHookName.UseUnderscores"/>
33-
<exclude name="WordPress.Files.FileName"/>
34-
35-
<!-- Definitely should not be added back -->
36-
<exclude name="WordPress.PHP.DisallowShortTernary.Found"/>
37-
<exclude name="WordPress.CodeAnalysis.AssignmentInCondition.Found"/>
38-
39-
<!-- Added back in WPGraphQL-Strict -->
33+
<!-- This would be a breaking change to fix in Core -->
4034
<exclude name="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid"/>
41-
<exclude name="WordPress.DateTime.RestrictedFunctions.date_date"/>
4235
</rule>
4336

4437
<!-- Tests for inline documentation of code -->
@@ -52,8 +45,30 @@
5245
<!-- Enforce short array syntax -->
5346
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
5447

55-
<!-- Enforce FQCN in comments -->
56-
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation"/>
57-
<!-- Enforce static closures -->
48+
<!--
49+
Slevomat sniffs
50+
See: https://github.com/slevomat/coding-standard/tree/master#alphabetical-list-of-sniffs
51+
-->
52+
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility" />
53+
<rule ref="SlevomatCodingStandard.Classes.DisallowConstructorPropertyPromotion" />
54+
<rule ref="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants" />
55+
<rule ref="SlevomatCodingStandard.Classes.DisallowMultiConstantDefinition" />
56+
<rule ref="SlevomatCodingStandard.Classes.DisallowMultiPropertyDefinition" />
57+
<rule ref="SlevomatCodingStandard.Classes.DisallowStringExpressionPropertyFetch" />
58+
<rule ref="SlevomatCodingStandard.Classes.UselessLateStaticBinding" />
59+
60+
<rule ref="SlevomatCodingStandard.ControlStructures.UselessTernaryOperator" />
61+
5862
<rule ref="SlevomatCodingStandard.Functions.StaticClosure" />
63+
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure" />
64+
<rule ref="SlevomatCodingStandard.Functions.UselessParameterDefaultValue" />
65+
66+
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation"/>
67+
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash" />
68+
69+
<rule ref="SlevomatCodingStandard.PHP.OptimizedFunctionsWithoutUnpacking" />
70+
<rule ref="SlevomatCodingStandard.PHP.TypeCast" />
71+
72+
<rule ref="SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable" />
73+
5974
</ruleset>

WPGraphQL-Strict/ruleset.xml

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,45 @@
66

77
<!-- The rules below are the changes from between the original sniff or parent ruleset, and what should be applied for this Standard. -->
88

9-
<!-- These are disabled in WPGraphQL core but should be reenabled. -->
9+
<!-- These are disabled in WPGraphQL-Minimum but should be reenabled. -->
1010
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
1111
<properties>
1212
<property name="blank_line_check" value="true"/>
1313
</properties>
1414
</rule>
15-
<rule ref="Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure">
15+
16+
<rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine">
1617
<severity>5</severity>
1718
</rule>
1819
<rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
1920
<severity>5</severity>
2021
</rule>
21-
<rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine">
22-
<severity>5</severity>
23-
</rule>
2422
<rule ref="PEAR.Functions.FunctionCallSignature.MultipleArguments">
2523
<severity>5</severity>
2624
</rule>
2725
<rule ref="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid">
2826
<severity>5</severity>
2927
</rule>
30-
<rule ref="WordPress.DateTime.RestrictedFunctions.date_date">
31-
<severity>5</severity>
32-
</rule>
3328

3429
<!-- Additional commenting sniffs are in WPGraphQL-Docs -->
3530
<rule ref="Squiz.Commenting.FunctionComment">
3631
<!-- Enabled in WPGraphQL-Docs -->
3732
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop" />
3833
<exclude name="Squiz.Commenting.FunctionComment.EmptyThrows" />
3934
<properties>
40-
<property name="skipIfInheritdoc" value="true" />
35+
<property name="skipIfInheritdoc" value="true" />
4136
</properties>
4237
</rule>
4338

44-
<!-- Slevomat rules - subject to review -->
39+
<!--
40+
Slevomat sniffs
41+
See: https://github.com/slevomat/coding-standard/tree/master#alphabetical-list-of-sniffs
42+
-->
4543
<rule ref="SlevomatCodingStandard.Arrays">
46-
<!-- Conflicts with WPCS -->
47-
<exclude name="SlevomatCodingStandard.Arrays.SingleLineArrayWhitespace"/>
4844
<!-- Semantic sorting is a valid pattern -->
4945
<exclude name="SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys"/>
46+
<!-- Conflicts with WPCS -->
47+
<exclude name="SlevomatCodingStandard.Arrays.SingleLineArrayWhitespace"/>
5048
</rule>
5149

5250
<rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference">
@@ -56,30 +54,13 @@
5654
</properties>
5755
</rule>
5856
<rule ref="SlevomatCodingStandard.Classes.RequireSelfReference" />
59-
<rule ref="SlevomatCodingStandard.Classes.DisallowConstructorPropertyPromotion" />
60-
<rule ref="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants" />
61-
<rule ref="SlevomatCodingStandard.Classes.DisallowMultiConstantDefinition" />
62-
<rule ref="SlevomatCodingStandard.Classes.DisallowMultiPropertyDefinition" />
63-
<rule ref="SlevomatCodingStandard.Classes.DisallowStringExpressionPropertyFetch" />
64-
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility" />
65-
<rule ref="SlevomatCodingStandard.Classes.UselessLateStaticBinding" />
66-
67-
<rule ref="SlevomatCodingStandard.ControlStructures.UselessTernaryOperator" />
6857

6958
<rule ref="SlevomatCodingStandard.Exceptions.DeadCatch" />
7059
<rule ref="SlevomatCodingStandard.Exceptions.DisallowNonCapturingCatch" />
7160
<rule ref="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly" />
7261

73-
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure" />
74-
<rule ref="SlevomatCodingStandard.Functions.UselessParameterDefaultValue" />
75-
7662
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses" />
77-
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash" />
78-
79-
<rule ref="SlevomatCodingStandard.PHP.OptimizedFunctionsWithoutUnpacking" />
80-
<rule ref="SlevomatCodingStandard.PHP.TypeCast" />
8163

82-
<rule ref="SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable" />
8364
<rule ref="SlevomatCodingStandard.Variables.UnusedVariable" >
8465
<properties>
8566
<property name="ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach" value="true" />

0 commit comments

Comments
 (0)